Class: Onoma::Migration::Actions::PropertyChange
- Defined in:
- lib/onoma/migration/actions/property_change.rb
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nomenclature ⇒ Object
readonly
Returns the value of attribute nomenclature.
Instance Method Summary collapse
-
#initialize(element) ⇒ PropertyChange
constructor
A new instance of PropertyChange.
Methods inherited from Base
Constructor Details
#initialize(element) ⇒ PropertyChange
Returns a new instance of PropertyChange.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/onoma/migration/actions/property_change.rb', line 6 def initialize(element) name = element['property'].split('.') @nomenclature = name.first @name = name.second @changes = {} if element.has_attribute?('type') changes[:type] = element.attr('type').to_sym end if element.has_attribute?('fallbacks') @changes[:fallbacks] = element.attr('fallbacks').to_s.strip.split(/[[:space:]]*\,[[:space:]]*/).map(&:to_sym) end if element.has_attribute?('default') @changes[:default] = element.attr('default').to_sym end if element.has_attribute?('required') @changes[:required] = element.attr('required').to_s == 'true' end # @changes[:inherit] = !!(element.attr('inherit').to_s == 'true') if element.has_attribute?('choices') if type == :choice || type == :choice_list @changes[:choices] = element.attr('choices').to_s.strip.split(/[[:space:]]*\,[[:space:]]*/).map(&:to_sym) elsif type == :item || type == :item_list @changes[:choices] = element.attr('choices').to_s.strip.to_sym end end end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
5 6 7 |
# File 'lib/onoma/migration/actions/property_change.rb', line 5 def changes @changes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/onoma/migration/actions/property_change.rb', line 5 def name @name end |
#nomenclature ⇒ Object (readonly)
Returns the value of attribute nomenclature.
5 6 7 |
# File 'lib/onoma/migration/actions/property_change.rb', line 5 def nomenclature @nomenclature end |