Class: Mapricot::HasManyAssociation

Inherits:
Association show all
Defined in:
lib/mapricot/associations.rb

Constant Summary

Constants inherited from Association

Association::VALID_TYPES

Instance Attribute Summary

Attributes inherited from Association

#name, #namespace, #type, #value

Instance Method Summary collapse

Methods inherited from Association

#initialize, #tag_name

Constructor Details

This class inherits a constructor from Mapricot::Association

Instance Method Details

#set_value_from_node_list(node_list) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/mapricot/associations.rb', line 87

def set_value_from_node_list(node_list)
  @value = []
  node_list.each do |node|
    if @type == :xml
      @value << class_from_name.new(node.to_s)
    else
      @value << node.contents
    end
  end
  typecast
end

#singular_nameObject



83
84
85
# File 'lib/mapricot/associations.rb', line 83

def singular_name
  "#{@name}".singularize
end