Class: MongoDbUtils::Tools::Option
- Inherits:
-
Object
- Object
- MongoDbUtils::Tools::Option
- Defined in:
- lib/mongo-db-utils/tools/commands.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(key, value = nil) ⇒ Option
constructor
A new instance of Option.
- #to_s ⇒ Object
Constructor Details
#initialize(key, value = nil) ⇒ Option
Returns a new instance of Option.
114 115 116 117 |
# File 'lib/mongo-db-utils/tools/commands.rb', line 114 def initialize(key,value = nil) @key = key @value = value end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
112 113 114 |
# File 'lib/mongo-db-utils/tools/commands.rb', line 112 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
112 113 114 |
# File 'lib/mongo-db-utils/tools/commands.rb', line 112 def value @value end |
Instance Method Details
#empty? ⇒ Boolean
119 120 121 |
# File 'lib/mongo-db-utils/tools/commands.rb', line 119 def empty? (@value.nil? || @value.empty?) end |
#to_s ⇒ Object
123 124 125 126 127 128 129 |
# File 'lib/mongo-db-utils/tools/commands.rb', line 123 def to_s if empty? nil else "#{@key} #{@value}" end end |