Module: Composable::Core::AttributeDSL::ClassMethods

Defined in:
lib/composable/core/attribute_dsl.rb

Instance Method Summary collapse

Instance Method Details

#attribute(*attrs) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/composable/core/attribute_dsl.rb', line 45

def attribute(*attrs)
  options = attrs.extract_options!

  return attributes if attrs.empty?

  attrs.each do |attribute|
    _save_options_for(attribute, **options)

    next if attributes.include?(attribute.to_sym)

    _define_getter(attribute)
    _define_setter(attribute)
    _define_question_mark_method(attribute)
    attributes << attribute.to_sym
  end
end