Class: Munson::Client
- Extended by:
- Forwardable
- Defined in:
- lib/munson/client.rb
Instance Attribute Summary collapse
- #path ⇒ Object
-
#query_builder ⇒ Object
writeonly
Sets the attribute query_builder.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #agent ⇒ Object
- #configure {|_self| ... } ⇒ Object
- #connection ⇒ Object
- #connection=(connection) ⇒ Object
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
- #query ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/munson/client.rb', line 11 def initialize(opts={}) opts.each do |k,v| setter = "#{k}=" send(setter,v) if respond_to?(setter) end end |
Instance Attribute Details
#path ⇒ Object
26 27 28 |
# File 'lib/munson/client.rb', line 26 def path @path || type.to_s end |
#query_builder=(value) ⇒ Object (writeonly)
Sets the attribute query_builder
8 9 10 |
# File 'lib/munson/client.rb', line 8 def query_builder=(value) @query_builder = value end |
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/munson/client.rb', line 9 def type @type end |
Instance Method Details
#agent ⇒ Object
22 23 24 |
# File 'lib/munson/client.rb', line 22 def agent Agent.new(path, connection: connection) end |
#configure {|_self| ... } ⇒ Object
30 31 32 33 |
# File 'lib/munson/client.rb', line 30 def configure(&block) yield(self) self end |
#connection ⇒ Object
35 36 37 |
# File 'lib/munson/client.rb', line 35 def connection @connection ||= Munson.default_connection.clone end |
#connection=(connection) ⇒ Object
39 40 41 |
# File 'lib/munson/client.rb', line 39 def connection=(connection) @connection = connection end |