Sha256: 8dbf65120b979bb24bfae7af09ae7328ff0978df112e623adc545a066b643432

Contents?: true

Size: 841 Bytes

Versions: 5

Compression:

Stored size: 841 Bytes

Contents

module Onoma
  module Migration
    module Actions
      class NomenclatureChange < Onoma::Migration::Actions::Base
        attr_reader :nomenclature, :changes

        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

        def human_name
          "Update nomenclature #{@name} with " + changes.inspect
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
onoma-0.4.2 lib/onoma/migration/actions/nomenclature_change.rb
onoma-0.5.1 lib/onoma/migration/actions/nomenclature_change.rb
onoma-0.5.0 lib/onoma/migration/actions/nomenclature_change.rb
onoma-0.4.1 lib/onoma/migration/actions/nomenclature_change.rb
onoma-0.4.0 lib/onoma/migration/actions/nomenclature_change.rb