Created
January 6, 2013 01:39
-
-
Save ConradIrwin/4464704 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post | |
def initialize(params) | |
@params = params | |
end | |
def safe_title | |
make_safe @params[:title] | |
end | |
def make_safe(str) | |
str.gsub(/[^\w]/, '-') | |
end | |
end | |
new_post = Post.new('title' => 'new post', 'body' => 'your text here') | |
puts new_post.safe_title | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment