Module: Winch::Base::InstanceMethods
- Defined in:
- lib/winch/base.rb
Instance Method Summary collapse
Instance Method Details
#initialize_winch(attributes) ⇒ Object
12 13 14 15 16 |
# File 'lib/winch/base.rb', line 12 def initialize_winch(attributes) (self.must_haves || {}).each do |name, clause| set_default_for_attribute(attributes, clause) end end |
#preform_type_check ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/winch/base.rb', line 18 def preform_type_check @broken_attributes ||= [] attributes.keys.each { |name| find_broken_in_node(name, attributes[name]) } @well_typed = @broken_attributes.blank? return if @well_typed return unless self.class.parent == Object raise Winch::TypeError.new(:object => self) if Winch.config.raise_on_broken_attributes end |