Class: Jetmeter::Config
- Inherits:
-
Object
- Object
- Jetmeter::Config
- Defined in:
- lib/jetmeter/config.rb,
lib/jetmeter/config/flow.rb,
lib/jetmeter/config/file_cache_store.rb,
lib/jetmeter/config/client_middleware.rb
Defined Under Namespace
Classes: ClientMiddleware, FileCacheStore, Flow
Instance Attribute Summary collapse
-
#cache_path ⇒ Object
writeonly
Sets the attribute cache_path.
-
#flows ⇒ Object
readonly
Returns the value of attribute flows.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#repository_name ⇒ Object
Returns the value of attribute repository_name.
Instance Method Summary collapse
- #client ⇒ Object
- #github_credentials=(credentials) ⇒ Object
-
#initialize(api: Octokit::Client, middleware: Jetmeter::Config::ClientMiddleware) {|_self| ... } ⇒ Config
constructor
A new instance of Config.
- #register_flow(flow_name, &block) ⇒ Object
Constructor Details
#initialize(api: Octokit::Client, middleware: Jetmeter::Config::ClientMiddleware) {|_self| ... } ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/jetmeter/config.rb', line 8 def initialize(api: Octokit::Client, middleware: Jetmeter::Config::ClientMiddleware) raise ArgumentError unless block_given? @api = api @middleware = middleware @flows = {} @cache_path = nil yield self end |
Instance Attribute Details
#cache_path=(value) ⇒ Object (writeonly)
Sets the attribute cache_path
6 7 8 |
# File 'lib/jetmeter/config.rb', line 6 def cache_path=(value) @cache_path = value end |
#flows ⇒ Object (readonly)
Returns the value of attribute flows.
5 6 7 |
# File 'lib/jetmeter/config.rb', line 5 def flows @flows end |
#output_path ⇒ Object
Returns the value of attribute output_path.
4 5 6 |
# File 'lib/jetmeter/config.rb', line 4 def output_path @output_path end |
#repository_name ⇒ Object
Returns the value of attribute repository_name.
3 4 5 |
# File 'lib/jetmeter/config.rb', line 3 def repository_name @repository_name end |
Instance Method Details
#client ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/jetmeter/config.rb', line 24 def client @_client ||= begin client = @api.new(@github_credentials) client.auto_paginate = true client.middleware = @middleware.build(@cache_path) if @cache_path client end end |
#github_credentials=(credentials) ⇒ Object
19 20 21 22 |
# File 'lib/jetmeter/config.rb', line 19 def github_credentials=(credentials) @github_credentials = credentials @_client = nil end |
#register_flow(flow_name, &block) ⇒ Object
33 34 35 |
# File 'lib/jetmeter/config.rb', line 33 def register_flow(flow_name, &block) @flows[flow_name] = Jetmeter::Config::Flow.new.tap(&block) end |