Class: Synapse::Easy::Section::Base
- Inherits:
-
Object
- Object
- Synapse::Easy::Section::Base
- Includes:
- Fake::Hash
- Defined in:
- lib/synapse/easy/section/base.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#port ⇒ Object
Returns the value of attribute port.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #bind ⇒ Object
- #each(*args, &block) ⇒ Object
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
- #label ⇒ Object
- #section_options ⇒ Object
- #to_synapse ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Base
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/synapse/easy/section/base.rb', line 11 def initialize params={} @address = params[:address] @address ||= "localhost" @port = params[:port] @port ||= Freeport.port @name = params[:name] @type = params[:type] @type ||= "frontend" = params[:options] ||= [] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
10 11 12 |
# File 'lib/synapse/easy/section/base.rb', line 10 def address @address end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/synapse/easy/section/base.rb', line 10 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/synapse/easy/section/base.rb', line 10 def end |
#port ⇒ Object
Returns the value of attribute port.
10 11 12 |
# File 'lib/synapse/easy/section/base.rb', line 10 def port @port end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/synapse/easy/section/base.rb', line 10 def type @type end |
Instance Method Details
#bind ⇒ Object
31 32 33 |
# File 'lib/synapse/easy/section/base.rb', line 31 def bind [address,port].compact.join(":") end |
#each(*args, &block) ⇒ Object
28 29 30 |
# File 'lib/synapse/easy/section/base.rb', line 28 def each *args, &block .each(*args,&block) end |
#label ⇒ Object
22 23 24 |
# File 'lib/synapse/easy/section/base.rb', line 22 def label "#{type} #{name}" end |
#section_options ⇒ Object
25 26 27 |
# File 'lib/synapse/easy/section/base.rb', line 25 def end |
#to_synapse ⇒ Object
34 35 36 37 38 |
# File 'lib/synapse/easy/section/base.rb', line 34 def to_synapse { label => } end |