Class: Nomen::Migration::Actions::NomenclatureCreation

Inherits:
Base
  • Object
show all
Defined in:
lib/nomen/migration/actions/nomenclature_creation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

action_name, #action_name

Constructor Details

#initialize(element) ⇒ NomenclatureCreation

Returns a new instance of NomenclatureCreation.


7
8
9
10
11
12
13
14
# File 'lib/nomen/migration/actions/nomenclature_creation.rb', line 7

def initialize(element)
  @nomenclature = element.key?('nomenclature') ? element['nomenclature'].to_s : element.key?('name') ? element['name'].to_s : nil
  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

#nomenclatureObject (readonly) Also known as: name

Returns the value of attribute nomenclature


5
6
7
# File 'lib/nomen/migration/actions/nomenclature_creation.rb', line 5

def nomenclature
  @nomenclature
end

#optionsObject (readonly)

Returns the value of attribute options


5
6
7
# File 'lib/nomen/migration/actions/nomenclature_creation.rb', line 5

def options
  @options
end

Instance Method Details

#human_nameObject


18
19
20
# File 'lib/nomen/migration/actions/nomenclature_creation.rb', line 18

def human_name
  "Create nomenclature #{@name}"
end