Class: Onoma::Migration::Actions::NomenclatureCreation
- Defined in:
- lib/onoma/migration/actions/nomenclature_creation.rb
Instance Attribute Summary collapse
-
#nomenclature ⇒ Object
(also: #name)
readonly
Returns the value of attribute nomenclature.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #human_name ⇒ Object
-
#initialize(element) ⇒ NomenclatureCreation
constructor
A new instance of NomenclatureCreation.
Methods inherited from Base
Constructor Details
#initialize(element) ⇒ NomenclatureCreation
Returns a new instance of NomenclatureCreation.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/onoma/migration/actions/nomenclature_creation.rb', line 7 def initialize(element) @nomenclature = if element.key?('nomenclature') element['nomenclature'].to_s elsif element.key?('name') element['name'].to_s else nil end raise 'No given name' unless @nomenclature @options = {} notions = element.attr('notions').to_s.split(/\s*\,\s*/).map(&:to_sym) @options[:notions] = notions if notions.any? @options[:translateable] = element.attr('translateable').to_s != 'false' end |
Instance Attribute Details
#nomenclature ⇒ Object (readonly) Also known as: name
Returns the value of attribute nomenclature.
5 6 7 |
# File 'lib/onoma/migration/actions/nomenclature_creation.rb', line 5 def nomenclature @nomenclature end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/onoma/migration/actions/nomenclature_creation.rb', line 5 def @options end |
Instance Method Details
#human_name ⇒ Object
25 26 27 |
# File 'lib/onoma/migration/actions/nomenclature_creation.rb', line 25 def human_name "Create nomenclature #{@name}" end |