class Yoda::Store::Objects::Tag
Attributes
lexical_scope[R]
@return [Array<String>]
name[R]
@return [String, nil]
tag_name[R]
@return [String]
text[R]
@return [String, nil]
yard_types[R]
@return [Array<String>]
Public Class Methods
json_creatable?()
click to toggle source
# File lib/yoda/store/objects/tag.rb, line 6 def json_creatable? true end
json_create(params)
click to toggle source
@param params [Hash]
# File lib/yoda/store/objects/tag.rb, line 11 def json_create(params) new(params.map { |k, v| [k.to_sym, v] }.select { |(k, v)| %i(tag_name name yard_types text lexical_scope).include?(k) }.to_h) end
new(tag_name:, name: nil, yard_types: [], text: nil, lexical_scope: [])
click to toggle source
@param tag_name
[String] @param name [String, nil] @param yard_types
[Array<String>] @param text [String, nil] @param lexical_scope
[Array<String>]
# File lib/yoda/store/objects/tag.rb, line 30 def initialize(tag_name:, name: nil, yard_types: [], text: nil, lexical_scope: []) @tag_name = tag_name @name = name @yard_types = yard_types @text = text @lexical_scope = lexical_scope end
Public Instance Methods
==(another)
click to toggle source
# File lib/yoda/store/objects/tag.rb, line 51 def ==(another) eql?(another) end
eql?(another)
click to toggle source
# File lib/yoda/store/objects/tag.rb, line 47 def eql?(another) self.class == another.class && to_h == another.to_h end
hash()
click to toggle source
# File lib/yoda/store/objects/tag.rb, line 43 def hash ([self.class.name] + to_h.to_a).hash end
to_h()
click to toggle source
@return [Hash]
# File lib/yoda/store/objects/tag.rb, line 39 def to_h { name: name, tag_name: tag_name, yard_types: yard_types, text: text, lexical_scope: lexical_scope } end
to_json(_state = nil)
click to toggle source
@return [String]
# File lib/yoda/store/objects/tag.rb, line 56 def to_json(_state = nil) to_h.merge(json_class: self.class.name).to_json end