Class: SetupConfiguration::SetupCodeBinding
- Inherits:
-
Generator::TemplateBinding
- Object
- Generator::TemplateBinding
- SetupConfiguration::SetupCodeBinding
- Defined in:
- lib/setup_configuration/setup_code_binding.rb
Instance Attribute Summary
Attributes inherited from Generator::TemplateBinding
Instance Method Summary collapse
-
#initialize ⇒ SetupCodeBinding
constructor
A new instance of SetupCodeBinding.
- #key(symbol) ⇒ Object
- #longest_key_length ⇒ Object
-
#parameter_offset ⇒ Object
Offset for setup parameter numbers.
- #parameters ⇒ Object
Methods inherited from Generator::TemplateBinding
#categories, #find_param_by_number, #get_binding
Constructor Details
#initialize ⇒ SetupCodeBinding
Returns a new instance of SetupCodeBinding.
5 6 7 |
# File 'lib/setup_configuration/setup_code_binding.rb', line 5 def initialize super end |
Instance Method Details
#key(symbol) ⇒ Object
21 22 23 24 25 |
# File 'lib/setup_configuration/setup_code_binding.rb', line 21 def key(symbol) s=symbol.to_s delimiter='_' s.split(delimiter).collect() { |splitter| splitter.capitalize }.join(delimiter).ljust(longest_key_length) end |
#longest_key_length ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/setup_configuration/setup_code_binding.rb', line 29 def longest_key_length # find the length of the longest word unless @longest longest = parameters.inject(0) do |memo, param| memo >= param.key.to_s.length ? memo : param.key.to_s.length end @longest=longest + 5 end @longest end |
#parameter_offset ⇒ Object
Offset for setup parameter numbers. This offset is added to a parameter number when evaluated in controller.
17 18 19 |
# File 'lib/setup_configuration/setup_code_binding.rb', line 17 def parameter_offset 1300 end |
#parameters ⇒ Object
9 10 11 12 |
# File 'lib/setup_configuration/setup_code_binding.rb', line 9 def parameters #TODO use set or something similar suite.parameters.select() { |p| p.param? } end |