class Parxer::Attributes

Public Instance Methods

add_attribute(id, name: nil) click to toggle source
# File lib/parxer/collections/attributes.rb, line 3
def add_attribute(id, name: nil)
  if find_attribute(id)
    raise Parxer::AttributesError.new("trying to add attribute with existent id")
  end

  self << Parxer::Attribute.new(id, name: name)
  last
end
find_attribute(attribute_id) click to toggle source
# File lib/parxer/collections/attributes.rb, line 12
def find_attribute(attribute_id)
  find { |attribute| attribute.id == attribute_id.to_sym }
end