Class: VORuby::VOTables::VOTable::Type::YesNo

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/votables/types.rb

Overview

A class representing ‘yes’ or ‘no’.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#valueObject (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_sObject



174
175
176
# File 'lib/voruby/votables/types.rb', line 174

def to_s
"{#{@value}}"
end