Module: GEXF::Attribute::Definable

Included in:
NodeSet, SetOfSets
Defined in:
lib/gexf/attribute/definable.rb

Instance Method Summary collapse

Instance Method Details

#attribute_definitionsObject Also known as: defined_attributes



15
16
17
# File 'lib/gexf/attribute/definable.rb', line 15

def attribute_definitions
  @attribute_definitions ||= {}
end

#attributesObject



8
9
10
11
12
13
# File 'lib/gexf/attribute/definable.rb', line 8

def attributes
  Hash[*map do |item|
    attributes = item.attributes
    [item.id, attributes] if attributes && attributes.any?
   end.compact.flatten]
end

#define_attribute(id, title, opts = {}) ⇒ Object



3
4
5
6
# File 'lib/gexf/attribute/definable.rb', line 3

def define_attribute(id, title, opts={})
  @attribute_definitions ||= {}
  @attribute_definitions[id] = GEXF::Attribute.new(id, title, opts)
end