Class: RSpec::Puppet::Coverage::ResourceWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-puppet/coverage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource = nil) ⇒ ResourceWrapper

Returns a new instance of ResourceWrapper.



334
335
336
# File 'lib/rspec-puppet/coverage.rb', line 334

def initialize(resource = nil)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



332
333
334
# File 'lib/rspec-puppet/coverage.rb', line 332

def resource
  @resource
end

Instance Method Details

#to_hashObject



342
343
344
345
346
# File 'lib/rspec-puppet/coverage.rb', line 342

def to_hash
  {
    touched: touched?
  }
end

#to_json(opts) ⇒ Object



348
349
350
# File 'lib/rspec-puppet/coverage.rb', line 348

def to_json(opts)
  to_hash.to_json(opts)
end

#to_sObject



338
339
340
# File 'lib/rspec-puppet/coverage.rb', line 338

def to_s
  @resource.to_s
end

#touch!Object



352
353
354
# File 'lib/rspec-puppet/coverage.rb', line 352

def touch!
  @touched = true
end

#touched?Boolean

Returns:

  • (Boolean)


356
357
358
# File 'lib/rspec-puppet/coverage.rb', line 356

def touched?
  !!@touched
end