module WannabeBool::Attributes::ClassMethods
Public Instance Methods
attr_wannabe_bool(*attributes)
click to toggle source
# 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