Class: Hoth::ServiceModule::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/hoth/service_module.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Environment

Returns a new instance of Environment.



8
9
10
11
# File 'lib/hoth/service_module.rb', line 8

def initialize(&block)
  @endpoints = {}
  instance_eval(&block)
end

Instance Attribute Details

#endpointsObject

Returns the value of attribute endpoints.



6
7
8
# File 'lib/hoth/service_module.rb', line 6

def endpoints
  @endpoints
end

Instance Method Details

#[](endpoint_name) ⇒ Object



17
18
19
# File 'lib/hoth/service_module.rb', line 17

def [](endpoint_name)
  @endpoints[endpoint_name.to_sym]
end

#endpoint(endpoint_name, &block) ⇒ Object



13
14
15
# File 'lib/hoth/service_module.rb', line 13

def endpoint(endpoint_name, &block)
  @endpoints[endpoint_name.to_sym] = Endpoint.new(&block)
end