Class: Spread2RDF::Schema::Element
- Inherits:
-
Object
- Object
- Spread2RDF::Schema::Element
- Extended by:
- Forwardable
- Includes:
- Attributes
- Defined in:
- lib/spread2rdf/schema/element.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(parent, attr = {}, &block) ⇒ Element
constructor
A new instance of Element.
- #name ⇒ Object
- #source_name ⇒ Object
- #to_s ⇒ Object
- #worksheet ⇒ Object
Methods included from Attributes
#init_attributes, #inspect, #update_attributes
Constructor Details
#initialize(parent, attr = {}, &block) ⇒ Element
Returns a new instance of Element.
19 20 21 22 23 |
# File 'lib/spread2rdf/schema/element.rb', line 19 def initialize(parent, attr = {}, &block) @parent = parent @block = block init_attributes(attr) end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
15 16 17 |
# File 'lib/spread2rdf/schema/element.rb', line 15 def block @block end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
14 15 16 |
# File 'lib/spread2rdf/schema/element.rb', line 14 def parent @parent end |
Instance Method Details
#name ⇒ Object
25 26 27 |
# File 'lib/spread2rdf/schema/element.rb', line 25 def name (@name or @source_name).try(:to_sym) end |
#source_name ⇒ Object
29 30 31 |
# File 'lib/spread2rdf/schema/element.rb', line 29 def source_name (@source_name or @name).try(:to_s) end |
#to_s ⇒ Object
40 41 42 43 44 |
# File 'lib/spread2rdf/schema/element.rb', line 40 def to_s name = (self.name.to_s == self.source_name.to_s ? self.name : "#{self.name} (#{self.source_name})" ) "#{self.class.name.split('::').last}-schema #{name}" end |