Class: Yoda::Store::Objects::Overload
- Inherits:
-
Object
- Object
- Yoda::Store::Objects::Overload
- Defined in:
- lib/yoda/store/objects/overload.rb
Instance Attribute Summary collapse
- #document ⇒ String? readonly
- #name ⇒ String readonly
- #parameters ⇒ Array<(String, String)> readonly
- #tag_list ⇒ Array<Tag> readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, parameters: [], document: '', tag_list: []) ⇒ Overload
constructor
A new instance of Overload.
- #to_h ⇒ Hash
- #to_json(_mode = nil) ⇒ String
Constructor Details
#initialize(name:, parameters: [], document: '', tag_list: []) ⇒ Overload
Returns a new instance of Overload.
32 33 34 35 36 37 |
# File 'lib/yoda/store/objects/overload.rb', line 32 def initialize(name:, parameters: [], document: '', tag_list: []) @name = name @parameters = parameters @document = document @tag_list = tag_list end |
Instance Attribute Details
#document ⇒ String? (readonly)
23 24 25 |
# File 'lib/yoda/store/objects/overload.rb', line 23 def document @document end |
#name ⇒ String (readonly)
17 18 19 |
# File 'lib/yoda/store/objects/overload.rb', line 17 def name @name end |
#parameters ⇒ Array<(String, String)> (readonly)
20 21 22 |
# File 'lib/yoda/store/objects/overload.rb', line 20 def parameters @parameters end |
#tag_list ⇒ Array<Tag> (readonly)
26 27 28 |
# File 'lib/yoda/store/objects/overload.rb', line 26 def tag_list @tag_list end |
Class Method Details
.json_creatable? ⇒ Boolean
6 7 8 |
# File 'lib/yoda/store/objects/overload.rb', line 6 def json_creatable? true end |
.json_create(params) ⇒ Object
11 12 13 |
# File 'lib/yoda/store/objects/overload.rb', line 11 def json_create(params) new(**params.map { |k, v| [k.to_sym, v] }.select { |(k, v)| %i(name tag_list document parameters).include?(k) }.to_h) end |
Instance Method Details
#to_h ⇒ Hash
40 41 42 |
# File 'lib/yoda/store/objects/overload.rb', line 40 def to_h { name: name, parameters: parameters, document: document, tag_list: tag_list } end |
#to_json(_mode = nil) ⇒ String
45 46 47 |
# File 'lib/yoda/store/objects/overload.rb', line 45 def to_json(_mode = nil) to_h.merge(json_class: self.class.name).to_json end |