Module: Winch::Base::ClassMethods
- Defined in:
- lib/winch/base.rb
Instance Method Summary collapse
Instance Method Details
#must_have(name, options = {}) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/winch/base.rb', line 3 def must_have(name, ={}) #Either :default, or :faux can be anything including false and '', just not nil raise "%s can have either a default or a faux value, but not both." % name unless .values_at(:default, :faux).select { |v| !v.nil? }.length == 1 self.must_haves = (self.must_haves || {}).merge(name => .merge(:name => name)) end |