Class: Samovar::Flags
- Inherits:
-
Object
- Object
- Samovar::Flags
- Defined in:
- lib/samovar/flags.rb
Instance Method Summary collapse
-
#boolean? ⇒ Boolean
Whether or not this flag should have a true/false value if not specified otherwise.
- #count ⇒ Object
- #each(&block) ⇒ Object
- #first ⇒ Object
-
#initialize(text) ⇒ Flags
constructor
A new instance of Flags.
- #parse(input) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Method Details
#boolean? ⇒ Boolean
Whether or not this flag should have a true/false value if not specified otherwise.
23 24 25 |
# File 'lib/samovar/flags.rb', line 23 def boolean? @ordered.count == 1 and @ordered.first.boolean? end |
#count ⇒ Object
27 28 29 |
# File 'lib/samovar/flags.rb', line 27 def count return @ordered.count end |
#each(&block) ⇒ Object
14 15 16 |
# File 'lib/samovar/flags.rb', line 14 def each(&block) @ordered.each(&block) end |
#first ⇒ Object
18 19 20 |
# File 'lib/samovar/flags.rb', line 18 def first @ordered.first end |
#parse(input) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/samovar/flags.rb', line 35 def parse(input) @ordered.each do |flag| result = flag.parse(input) if result != nil return result end end return nil end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/samovar/flags.rb', line 31 def to_s "[#{@ordered.join(' | ')}]" end |