Class: SBConstants::CLI
- Inherits:
-
Object
- Object
- SBConstants::CLI
- Defined in:
- lib/sbconstants/cli.rb
Instance Attribute Summary collapse
-
#constants ⇒ Object
Returns the value of attribute constants.
-
#options ⇒ Object
Returns the value of attribute options.
-
#sections ⇒ Object
Returns the value of attribute sections.
-
#storyboards ⇒ Object
Returns the value of attribute storyboards.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
- #sanitise_key(key) ⇒ Object
- #sections_grouped_by_keypath ⇒ Object
Constructor Details
#initialize(options) ⇒ CLI
Returns a new instance of CLI.
11 12 13 14 15 |
# File 'lib/sbconstants/cli.rb', line 11 def initialize self. = self.constants = Hash.new { |h,k| h[k] = Set.new } self.storyboards = Array.new end |
Instance Attribute Details
#constants ⇒ Object
Returns the value of attribute constants.
5 6 7 |
# File 'lib/sbconstants/cli.rb', line 5 def constants @constants end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/sbconstants/cli.rb', line 5 def @options end |
#sections ⇒ Object
Returns the value of attribute sections.
5 6 7 |
# File 'lib/sbconstants/cli.rb', line 5 def sections @sections end |
#storyboards ⇒ Object
Returns the value of attribute storyboards.
5 6 7 |
# File 'lib/sbconstants/cli.rb', line 5 def storyboards @storyboards end |
Class Method Details
Instance Method Details
#run ⇒ Object
17 18 19 20 21 |
# File 'lib/sbconstants/cli.rb', line 17 def run parse_storyboards refute_key_collisions write end |
#sanitise_key(key) ⇒ Object
41 42 43 |
# File 'lib/sbconstants/cli.rb', line 41 def sanitise_key key key.gsub(" ", "").gsub("-", "") end |
#sections_grouped_by_keypath ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/sbconstants/cli.rb', line 33 def sections_grouped_by_keypath Hash.new { |h,k| h[k] = Set.new }.tap { |sections_grouped_by_keypath| constants.each do |constant, locations| sections_grouped_by_keypath[locations] << constant end } end |