Module: WannabeBool::Attributes::ClassMethods
- Defined in:
- lib/wannabe_bool/attributes.rb
Instance Method Summary collapse
Instance Method Details
#attr_wannabe_bool(*attributes) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/wannabe_bool/attributes.rb', line 8 def attr_wannabe_bool(*attributes) attributes.each do |attr| raise ArgumentError, "#{attr} method is not defined." unless method_defined?(attr) next if method_defined?("#{attr}?") define_method("#{attr}?") do send(attr).to_b end end end |