module Kind::ImmutableAttributes::Reader

Public Class Methods

included(base) click to toggle source
# File lib/kind/immutable_attributes/reader.rb, line 10
def self.included(base)
  base.send(:attr_reader, :attributes)
end

Public Instance Methods

attribute(name) click to toggle source
# File lib/kind/immutable_attributes/reader.rb, line 18
def attribute(name)
  @attributes[name.to_sym]
end
attribute!(name) click to toggle source
# File lib/kind/immutable_attributes/reader.rb, line 22
def attribute!(name)
  @attributes.fetch(name.to_sym)
end
attribute?(name) click to toggle source
# File lib/kind/immutable_attributes/reader.rb, line 14
def attribute?(name)
  self.class.__attributes__.key?(name.to_sym)
end
with_attribute(name, value) click to toggle source
# File lib/kind/immutable_attributes/reader.rb, line 26
def with_attribute(name, value)
  self.class.new(@_____attrs.merge(name.to_sym => value))
end
with_attributes(arg) click to toggle source
# File lib/kind/immutable_attributes/reader.rb, line 30
def with_attributes(arg)
  hash = STRICT.kind_of(::Hash, arg)

  self.class.new(@_____attrs.merge(hash))
end