Skip to content

Commit

Permalink
Added <name>? functions to boolean_options.
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Youch committed Apr 14, 2010
1 parent 6079570 commit 5bfb138
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/hash_model.rb
Expand Up @@ -111,6 +111,14 @@ def self.boolean_options(*objs)
class << self; self end.send(:define_method,"current_boolean_opts") do
objs
end

objs.each do |obj|
self.class_eval <<-EOF
def #{obj}?
! @#{obj}.blank?
end
EOF
end
end

def self.float_options(*objs)
Expand Down

0 comments on commit 5bfb138

Please sign in to comment.