Class: VORuby::VOTables::VOTable::Type::YesNo
- Defined in:
- lib/voruby/votables/types.rb
Overview
A class representing ‘yes’ or ‘no’.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(txt = nil) ⇒ YesNo
constructor
- txt:
-
A text string with the value ‘yes’ or ‘no’.
- #to_s ⇒ Object
Constructor Details
#initialize(txt = nil) ⇒ YesNo
- txt:
-
A text string with the value ‘yes’ or ‘no’.
166 167 168 169 170 171 172 |
# File 'lib/voruby/votables/types.rb', line 166 def initialize(txt=nil) if txt and (txt.downcase == 'yes' or txt.downcase == 'no') @value = txt.downcase else raise "YesNo '#{txt}' is not valid. Use one of: yes, no" end end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
162 163 164 |
# File 'lib/voruby/votables/types.rb', line 162 def value @value end |
Instance Method Details
#to_s ⇒ Object
174 175 176 |
# File 'lib/voruby/votables/types.rb', line 174 def to_s "{#{@value}}" end |