Class: SelfSDK::Services::Facts::Fact
- Inherits:
-
Object
- Object
- SelfSDK::Services::Facts::Fact
- Defined in:
- lib/services/facts.rb
Overview
Facts to be issued
Instance Attribute Summary collapse
-
#group ⇒ Object
Returns the value of attribute group.
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key, value, source, opts = {}) ⇒ Fact
constructor
A new instance of Fact.
- #to_hash ⇒ Object
Constructor Details
#initialize(key, value, source, opts = {}) ⇒ Fact
Returns a new instance of Fact.
120 121 122 123 124 125 126 127 |
# File 'lib/services/facts.rb', line 120 def initialize(key, value, source, opts = {}) @key = key @value = value @source = source @display_name = opts.fetch(:display_name, "") @group = opts.fetch(:group, nil) @type = opts.fetch(:type, nil) end |
Instance Attribute Details
#group ⇒ Object
Returns the value of attribute group.
117 118 119 |
# File 'lib/services/facts.rb', line 117 def group @group end |
#key ⇒ Object
Returns the value of attribute key.
117 118 119 |
# File 'lib/services/facts.rb', line 117 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
117 118 119 |
# File 'lib/services/facts.rb', line 117 def value @value end |
Instance Method Details
#to_hash ⇒ Object
129 130 131 132 133 134 |
# File 'lib/services/facts.rb', line 129 def to_hash b = { key: @key, value: @value, source: @source } b[:group] = @group.to_hash unless @group.nil? b[:type] = @type unless @type.nil? b end |