Class: Optimist::BooleanOption

Inherits:
Option
  • Object
show all
Defined in:
lib/firebase-ruby/optimist.rb

Overview

Flag option. Has no arguments. Can be negated with “no-”.

Instance Attribute Summary

Attributes inherited from Option

#default, #long, #multi_given, #name, #short

Instance Method Summary collapse

Methods inherited from Option

#array_default?, #callback, create, #desc, #description_with_default, #educate, #multi, #multi_arg?, #opts, #opts=, register_alias, #required?, #short?, #single_arg?, #type_format

Constructor Details

#initializeBooleanOption

Returns a new instance of BooleanOption.



754
755
756
757
# File 'lib/firebase-ruby/optimist.rb', line 754

def initialize
  super()
  @default = false
end

Instance Method Details

#flag?Boolean

Returns:

  • (Boolean)


758
# File 'lib/firebase-ruby/optimist.rb', line 758

def flag? ; true ; end

#parse(_paramlist, neg_given) ⇒ Object



759
760
761
# File 'lib/firebase-ruby/optimist.rb', line 759

def parse(_paramlist, neg_given)
  return(self.name.to_s =~ /^no_/ ? neg_given : !neg_given)
end