Class: Resourceful::Agent::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/resourceful/agent/base.rb

Direct Known Subclasses

Mechanize, RestClient

Constant Summary collapse

ATTRS =
[:host, :user, :password, :expiration, :log_prefix]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Base

Returns a new instance of Base.



14
15
16
17
18
19
# File 'lib/resourceful/agent/base.rb', line 14

def initialize(args={})
  ATTRS.each { |a| instance_variable_set("@#{a.to_s}", args.delete(a)) }
  @cache = Resourceful::Resource::Cache.new @expiration
  @logger = Log4r::Logger.new('[Resourceful]')
  @logger.add(Log4r::StdoutOutputter.new('console'))
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



9
10
11
# File 'lib/resourceful/agent/base.rb', line 9

def cache
  @cache
end

#expirationObject (readonly)

Returns the value of attribute expiration.



9
10
11
# File 'lib/resourceful/agent/base.rb', line 9

def expiration
  @expiration
end

#log_prefixObject (readonly)

Returns the value of attribute log_prefix.



9
10
11
# File 'lib/resourceful/agent/base.rb', line 9

def log_prefix
  @log_prefix
end

#loggerObject (readonly)

Returns the value of attribute logger.



9
10
11
# File 'lib/resourceful/agent/base.rb', line 9

def logger
  @logger
end