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.



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

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

Instance Attribute Details

#endpointsObject

Returns the value of attribute endpoints.



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

def endpoints
  @endpoints
end

Instance Method Details

#[](endpoint_name) ⇒ Object



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

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

#endpoint(endpoint_name, &block) ⇒ Object



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

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