Class: Turbotlib::Processor
- Inherits:
-
Object
- Object
- Turbotlib::Processor
- Extended by:
- Forwardable
- Defined in:
- lib/turbotlib/processor.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #assert(message) ⇒ Object
- #get(url) ⇒ Object
-
#initialize(output_dir, cache_dir, expires_in, level, logdev) ⇒ Processor
constructor
A new instance of Processor.
-
#now ⇒ String
The present UTC time in ISO 8601 format.
Constructor Details
#initialize(output_dir, cache_dir, expires_in, level, logdev) ⇒ Processor
Returns a new instance of Processor.
9 10 11 12 13 14 15 |
# File 'lib/turbotlib/processor.rb', line 9 def initialize(output_dir, cache_dir, expires_in, level, logdev) @logger = Logger.new('turbot', level, logdev) @client = Client.new(cache_dir, expires_in, level, logdev) @output_dir = output_dir FileUtils.mkdir_p(@output_dir) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/turbotlib/processor.rb', line 5 def client @client end |
Instance Method Details
#assert(message) ⇒ Object
21 22 23 |
# File 'lib/turbotlib/processor.rb', line 21 def assert() error() unless yield end |
#get(url) ⇒ Object
17 18 19 |
# File 'lib/turbotlib/processor.rb', line 17 def get(url) client.get(url).body end |
#now ⇒ String
Returns the present UTC time in ISO 8601 format.
26 27 28 |
# File 'lib/turbotlib/processor.rb', line 26 def now Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ') end |