Skip to content

Instantly share code, notes, and snippets.

@ConradIrwin
Created January 6, 2013 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ConradIrwin/4464704 to your computer and use it in GitHub Desktop.
Save ConradIrwin/4464704 to your computer and use it in GitHub Desktop.
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