Skip to content

Commit

Permalink
Merge commit 'core/hash-model-boolean' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Apr 17, 2010
2 parents faad2c3 + 5bfb138 commit 4081b25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/hash_model.rb
Original file line number Diff line number Diff line change
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 4081b25

Please sign in to comment.