Module: CustomFields::Types::Tags::Target::ClassMethods
- Defined in:
- lib/custom_fields/types/tags.rb
Instance Method Summary collapse
- #apply_tags_custom_field(klass, rule) ⇒ Object
- #tags_attribute_get(instance, name) ⇒ Object
- #tags_attribute_set(instance, name, attributes) ⇒ Object
Instance Method Details
#apply_tags_custom_field(klass, rule) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/custom_fields/types/tags.rb', line 12 def (klass, rule) klass.field rule['name'], localize: rule['localized'] || false, type: Array klass.class_eval do define_method("#{rule['name']}=") do |val| # FIXME: I would use is_a?(), but it doesn't work in my machine! val = val.split(/ *, */) if val.class.to_s == 'String' super(val) end end end |
#tags_attribute_get(instance, name) ⇒ Object
24 25 26 |
# File 'lib/custom_fields/types/tags.rb', line 24 def (instance, name) default_attribute_get(instance, name) end |
#tags_attribute_set(instance, name, attributes) ⇒ Object
28 29 30 |
# File 'lib/custom_fields/types/tags.rb', line 28 def (instance, name, attributes) default_attribute_set(instance, name, attributes) end |