Class: ToFactory::Representation

Inherits:
Object
  • Object
show all
Defined in:
lib/to_factory/representation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, parent_name, definition = nil, record = nil) ⇒ Representation

Returns a new instance of Representation.



10
11
12
13
# File 'lib/to_factory/representation.rb', line 10

def initialize(name, parent_name, definition=nil, record=nil)
  @name, @parent_name, @definition, @record =
    name.to_s, parent_name.to_s, definition, record
end

Instance Attribute Details

#definitionObject

Returns the value of attribute definition.



4
5
6
# File 'lib/to_factory/representation.rb', line 4

def definition
  @definition
end

#hierarchy_orderObject

Returns the value of attribute hierarchy_order.



4
5
6
# File 'lib/to_factory/representation.rb', line 4

def hierarchy_order
  @hierarchy_order
end

#klassObject

Returns the value of attribute klass.



4
5
6
# File 'lib/to_factory/representation.rb', line 4

def klass
  @klass
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/to_factory/representation.rb', line 4

def name
  @name
end

#parent_nameObject

Returns the value of attribute parent_name.



4
5
6
# File 'lib/to_factory/representation.rb', line 4

def parent_name
  @parent_name
end

#recordObject

Returns the value of attribute record.



4
5
6
# File 'lib/to_factory/representation.rb', line 4

def record
  @record
end

Class Method Details

.from(options) ⇒ Object



6
7
8
# File 'lib/to_factory/representation.rb', line 6

def self.from(options)
  OptionsParser.new(options).get_instance
end

Instance Method Details

#inspectObject



15
16
17
# File 'lib/to_factory/representation.rb', line 15

def inspect
  "#<ToFactory::Representation:#{object_id} @name: #{@name.inspect}, @parent_name: #{@parent_name.inspect}, @klass: #{klass_name_inspect}>"
end

#klass_name_inspectObject



19
20
21
# File 'lib/to_factory/representation.rb', line 19

def klass_name_inspect
  @klass.name.inspect rescue "nil"
end