Module: Kind::ImmutableAttributes::ClassMethods

Included in:
Action::ClassMethods
Defined in:
lib/kind/immutable_attributes.rb

Instance Method Summary collapse

Instance Method Details

#__attributes__Object

:nodoc:



12
13
14
# File 'lib/kind/immutable_attributes.rb', line 12

def __attributes__ # :nodoc:
  @__attributes__ ||= {}
end

#attribute(name, kind = nil, default: UNDEFINED, visibility: :public) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/kind/immutable_attributes.rb', line 16

def attribute(name, kind = nil, default: UNDEFINED, visibility: :public)
  __attributes__[ATTRIBUTES.name!(name)] = ATTRIBUTES.value(kind, default, visibility)

  attr_reader(name)

  private(name) if visibility == :private
  protected(name) if visibility == :protected

  name
end