Class: Yoda::Store::Objects::ValueObject
- Inherits:
-
Base
- Object
- Base
- Yoda::Store::Objects::ValueObject
show all
- Defined in:
- lib/yoda/store/objects/value_object.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#document, #path, #primary_source, #sources, #tag_list
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#==, #address, #eql?, #hash, #merge
#derive, included, #to_json
#address
Constructor Details
#initialize(value: nil, **kwargs) ⇒ ValueObject
Returns a new instance of ValueObject.
15
16
17
18
|
# File 'lib/yoda/store/objects/value_object.rb', line 15
def initialize(value: nil, **kwargs)
super(kwargs)
@value = value
end
|
Instance Attribute Details
#value ⇒ String
6
7
8
|
# File 'lib/yoda/store/objects/value_object.rb', line 6
def value
@value
end
|
Class Method Details
.attr_names ⇒ Array<Symbol>
9
10
11
|
# File 'lib/yoda/store/objects/value_object.rb', line 9
def self.attr_names
super + %i(value)
end
|
Instance Method Details
#kind ⇒ Object
25
26
27
|
# File 'lib/yoda/store/objects/value_object.rb', line 25
def kind
:value
end
|
#name ⇒ String
21
22
23
|
# 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 ⇒ Object
29
30
31
|
# File 'lib/yoda/store/objects/value_object.rb', line 29
def to_h
super.merge(value: value)
end
|