lib/morf/caster.rb
def attributes(&block)
      raise ArgumentError, "You should provide block" unless block_given?

      attributes = Morf::AttributesParser.parse(&block)
      self.class_variable_set(:@@attributes, attributes)
    end
def attributes(&block)
      raise ArgumentError, "You should provide block" unless block_given?

      attributes = Morf::AttributesParser.parse(&block)
      self.class_variable_set(:@@attributes, attributes)
    end
def attributes ( & block ) raise ArgumentError , "You should provide block" unless block_given? attributes = Morf :: AttributesParser . parse ( block ) self . class_variable_set ( :@@attributes , attributes ) end
Defines casting rules
 @example
  attributes do
    string   :first_name
    string   :last_name
    integer  :age, optional: true
  end
Defines casting rules