class Yoda::Store::Objects::ValueObject

Attributes

value[R]

@return [String]

Public Class Methods

attr_names() click to toggle source

@return [Array<Symbol>]

Calls superclass method Yoda::Store::Objects::Base::attr_names
# File lib/yoda/store/objects/value_object.rb, line 9
def self.attr_names
  super + %i(value)
end
new(value: nil, **kwargs) click to toggle source

@param path [String] @param value [String]

Calls superclass method Yoda::Store::Objects::Base::new
# File lib/yoda/store/objects/value_object.rb, line 15
def initialize(value: nil, **kwargs)
  super(kwargs)
  @value = value
end

Public Instance Methods

kind() click to toggle source
# File lib/yoda/store/objects/value_object.rb, line 25
def kind
  :value
end
name() click to toggle source

@return [String]

# File lib/yoda/store/objects/value_object.rb, line 21
def name
  @name ||= path.match(MODULE_TAIL_PATTERN) { |md| md[1] || md[2] }
end
to_h() click to toggle source
Calls superclass method Yoda::Store::Objects::Base#to_h
# File lib/yoda/store/objects/value_object.rb, line 29
def to_h
  super.merge(value: value)
end

Private Instance Methods

merge_attributes(another) click to toggle source

@param another [self] @return [Hash]

# File lib/yoda/store/objects/value_object.rb, line 37
def merge_attributes(another)
  super.merge(
    value: another.value || self.value,
  )
end