class Onoma::Migration::Actions::ItemChange

Attributes

changes[R]
name[R]
nomenclature[R]

Public Class Methods

new(element) click to toggle source
# File lib/onoma/migration/actions/item_change.rb, line 6
def initialize(element)
  name = element['item'].split('#')
  @nomenclature = name.first
  @name = name.second
  @changes = element.attributes
                    .delete_if { |k, _v| %w[item].include?(k) }
                    .each_with_object({}) do |(k, v), h|
                      h[k.to_sym] = (v.to_s.blank? ? nil : v.to_s)
                    end
end

Public Instance Methods

human_name() click to toggle source
# File lib/onoma/migration/actions/item_change.rb, line 25
def human_name
  "Change item #{@nomenclature}##{@name} with " + changes.inspect
end
new_name() click to toggle source
# File lib/onoma/migration/actions/item_change.rb, line 21
def new_name
  @changes[:name]
end
new_name?() click to toggle source
# File lib/onoma/migration/actions/item_change.rb, line 17
def new_name?
  @changes[:name].present?
end