Class: Nobel::Config
- Inherits:
-
Object
- Object
- Nobel::Config
- Defined in:
- lib/nobel/config.rb
Instance Attribute Summary collapse
-
#api_host ⇒ Object
Returns the value of attribute api_host.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#http_client ⇒ Object
Returns the value of attribute http_client.
-
#json_parser ⇒ Object
Returns the value of attribute json_parser.
Instance Method Summary collapse
- #base_url ⇒ Object
- #debug? ⇒ Boolean
-
#initialize {|_self| ... } ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize {|_self| ... } ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 14 15 16 |
# File 'lib/nobel/config.rb', line 8 def initialize @api_host = 'api.nobelprize.org' @api_version = 'v1' @json_parser = ->(d) { JSON.parse(d) } @http_client = Nobel::HTTP @debug = false yield self if block_given? end |
Instance Attribute Details
#api_host ⇒ Object
Returns the value of attribute api_host.
5 6 7 |
# File 'lib/nobel/config.rb', line 5 def api_host @api_host end |
#api_version ⇒ Object
Returns the value of attribute api_version.
5 6 7 |
# File 'lib/nobel/config.rb', line 5 def api_version @api_version end |
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/nobel/config.rb', line 5 def debug @debug end |
#http_client ⇒ Object
Returns the value of attribute http_client.
5 6 7 |
# File 'lib/nobel/config.rb', line 5 def http_client @http_client end |
#json_parser ⇒ Object
Returns the value of attribute json_parser.
5 6 7 |
# File 'lib/nobel/config.rb', line 5 def json_parser @json_parser end |
Instance Method Details
#base_url ⇒ Object
18 19 20 |
# File 'lib/nobel/config.rb', line 18 def base_url "http://#{api_host}/#{api_version}" end |
#debug? ⇒ Boolean
22 23 24 |
# File 'lib/nobel/config.rb', line 22 def debug? debug end |