Class: Inspec::Object::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/objects/tag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ Tag

Returns a new instance of Tag.



5
6
7
8
# File 'lib/inspec/objects/tag.rb', line 5

def initialize(key, value)
  @key = key
  @value = value
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



3
4
5
# File 'lib/inspec/objects/tag.rb', line 3

def key
  @key
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/inspec/objects/tag.rb', line 3

def value
  @value
end

Instance Method Details

#to_hashObject



10
11
12
13
14
15
# File 'lib/inspec/objects/tag.rb', line 10

def to_hash
  {
    name: key,
    value: value,
  }
end

#to_rubyObject



17
18
19
# File 'lib/inspec/objects/tag.rb', line 17

def to_ruby
  "tag #{key}: #{value.inspect}"
end

#to_sObject



21
22
23
# File 'lib/inspec/objects/tag.rb', line 21

def to_s
  "Tag #{key} with #{value}"
end