Class: Daneel::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/daneel/plugin.rb

Direct Known Subclasses

Adapter, Script

Defined Under Namespace

Classes: DepError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(robot) ⇒ Plugin

Returns a new instance of Plugin.



5
6
7
# File 'lib/daneel/plugin.rb', line 5

def initialize(robot)
  @robot = robot
end

Instance Attribute Details

#robotObject (readonly)

Returns the value of attribute robot.



3
4
5
# File 'lib/daneel/plugin.rb', line 3

def robot
  @robot
end

Class Method Details

.requires_env(*keys) ⇒ Object

Raises:



15
16
17
18
# File 'lib/daneel/plugin.rb', line 15

def self.requires_env(*keys)
  missing = keys.flatten.select{|k| ENV[k].nil? || ENV[k].empty? }
  raise DepError, "#{missing.join(',')} must be set" if missing.any?
end

Instance Method Details

#loggerObject



9
10
11
# File 'lib/daneel/plugin.rb', line 9

def logger
  robot.logger
end