Class: ChefLicensing::Context::State

Inherits:
Object
  • Object
show all
Defined in:
lib/chef-licensing/context.rb

Direct Known Subclasses

Global, Local

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context.



88
89
90
# File 'lib/chef-licensing/context.rb', line 88

def context
  @context
end

#optionsObject

Returns the value of attribute options.



88
89
90
# File 'lib/chef-licensing/context.rb', line 88

def options
  @options
end

Instance Method Details

#licenseObject

Get license context in local or global state



96
97
98
99
100
101
102
# File 'lib/chef-licensing/context.rb', line 96

def license
  if license_keys.empty?
    @license ||= nil
  else
    @license ||= ChefLicensing.client(license_keys: license_keys)
  end
end

#license=(license) ⇒ Object

Set license context in local or global state



105
106
107
# File 'lib/chef-licensing/context.rb', line 105

def license=(license)
  @license ||= license
end

#license_keysObject

This method is abstract.

Raises:

  • (NotImplementedError)


91
92
93
# File 'lib/chef-licensing/context.rb', line 91

def license_keys
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end