Class: Onoma::Migration::Actions::NomenclatureChange
- Defined in:
- lib/onoma/migration/actions/nomenclature_change.rb
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#nomenclature ⇒ Object
readonly
Returns the value of attribute nomenclature.
Instance Method Summary collapse
- #human_name ⇒ Object
-
#initialize(element) ⇒ NomenclatureChange
constructor
A new instance of NomenclatureChange.
Methods inherited from Base
action_name, #action_name, #label
Constructor Details
#initialize(element) ⇒ NomenclatureChange
Returns a new instance of NomenclatureChange.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/onoma/migration/actions/nomenclature_change.rb', line 7 def initialize(element) raise 'No given name' unless element.key?('nomenclature') @nomenclature = element['nomenclature'].to_s @changes = {} @changes[:name] = element['name'].to_s if element.key?('name') if element.key?('notions') @changes[:notions] = element.attr('notions').to_s.split(/\s*\,\s*/).map(&:to_sym) end if element.key?('translateable') @changes[:translateable] = element.attr('translateable').to_s != 'false' end end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
5 6 7 |
# File 'lib/onoma/migration/actions/nomenclature_change.rb', line 5 def changes @changes end |
#nomenclature ⇒ Object (readonly)
Returns the value of attribute nomenclature.
5 6 7 |
# File 'lib/onoma/migration/actions/nomenclature_change.rb', line 5 def nomenclature @nomenclature end |
Instance Method Details
#human_name ⇒ Object
20 21 22 |
# File 'lib/onoma/migration/actions/nomenclature_change.rb', line 20 def human_name "Update nomenclature #{@name} with " + changes.inspect end |