Sha256: c52df0a6de2f0320981a5ae1a097e6e909e28859cd36c30b0368be6d8b4a11c1

Contents?: true

Size: 791 Bytes

Versions: 1

Compression:

Stored size: 791 Bytes

Contents

module Onoma
  module Migration
    module Actions
      class NomenclatureCreation < Onoma::Migration::Actions::Base
        attr_reader :nomenclature, :options

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

        alias_method :name, :nomenclature

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onoma-0.0.0 lib/onoma/migration/actions/nomenclature_creation.rb