Class: BBFlow::Options
- Inherits:
-
Object
- Object
- BBFlow::Options
- Defined in:
- lib/bb_flow/options.rb
Constant Summary collapse
- ALLOWED_OPTIONS =
{ base_branch: { default_value: 'master' }, commit_message: {} }
Class Method Summary collapse
Class Method Details
.default(name) ⇒ Object
37 38 39 40 41 |
# File 'lib/bb_flow/options.rb', line 37 def default(name) raise ArgumentError, "Trying to get a default for an unknown option #{name}" unless ALLOWED_OPTIONS.keys.include?(name) ALLOWED_OPTIONS[name][:default_value] end |
.get(name) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/bb_flow/options.rb', line 26 def get(name) raise ArgumentError, "Trying to get an unknown option #{name}" unless ALLOWED_OPTIONS.keys.include?(name) @storage ||= {} @storage[name] || default(name) end |
.set(name, value) ⇒ void
This method returns an undefined value.
15 16 17 18 19 20 |
# File 'lib/bb_flow/options.rb', line 15 def set(name, value) raise ArgumentError "Trying to set an unknown option #{name}" unless ALLOWED_OPTIONS.keys.include?(name) @storage ||= {} @storage[name] = value end |