Class: VORuby::VOTable::V1_0::Values

Inherits:
Base show all
Defined in:
lib/voruby/votable/1.0/votable.rb

Overview

Holds subsidiary information about the domain of the data.

Constant Summary collapse

ELEMENT_NAME =
'VALUES'

Instance Attribute Summary

Attributes inherited from XML::Object::Base

#node

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, element_name, #get_element, #xpath_for

Methods inherited from XML::Object::Base

#==, element_name, from_file, #to_s

Constructor Details

#initialize(defn = nil) ⇒ Values

Create some new subsidiary information about the domain.

values = Values.new(
  :id => 'RAdomain',
  :min => Min.new(:value => '0'),
  :max => Max.new(:value => '360', :inclusive => false)
)


1185
1186
1187
1188
# File 'lib/voruby/votable/1.0/votable.rb', line 1185

def initialize(defn=nil)
  super(defn)
  self.type = 'legal' if !self.type
end

Class Method Details

.serialization_orderObject



1172
1173
1174
1175
1176
1177
# File 'lib/voruby/votable/1.0/votable.rb', line 1172

def self.serialization_order
  [
    :min, :max, :options,
    :id, :type, :null, :invalid
  ]
end

Instance Method Details

#idObject



1190
1191
1192
# File 'lib/voruby/votable/1.0/votable.rb', line 1190

def id
  self.node['ID']
end

#id=(i) ⇒ Object



1194
1195
1196
# File 'lib/voruby/votable/1.0/votable.rb', line 1194

def id=(i)
  @node['ID'] = i.to_s
end

#invalidObject



1219
1220
1221
# File 'lib/voruby/votable/1.0/votable.rb', line 1219

def invalid
  self.node['invalid']
end

#invalid=(i) ⇒ Object

Set the invalid flag. Takes boolean value or the strings yes/no.



1231
1232
1233
1234
1235
1236
1237
1238
1239
# File 'lib/voruby/votable/1.0/votable.rb', line 1231

def invalid=(i)
  if i.is_a?(TrueClass)
    @node['invalid'] = 'yes'
  elsif i.is_a?(FalseClass)
    @node['invalid'] = 'no'
  else
    @node['invalid'] = i.to_s
  end
end

#invalid?Boolean

Returns a boolean depending on whether the value is considered invalid.

Returns:

  • (Boolean)


1225
1226
1227
# File 'lib/voruby/votable/1.0/votable.rb', line 1225

def invalid?
  self.node['invalid'] == 'yes'
end

#maxObject

Retrieve the maximum of the value (Max).



1242
1243
1244
# File 'lib/voruby/votable/1.0/votable.rb', line 1242

def max
  get_element(Max)
end

#max=(m) ⇒ Object

Set the maximum of the value (Max).



1247
1248
1249
# File 'lib/voruby/votable/1.0/votable.rb', line 1247

def max=(m)
  set_element(Max, m)
end

#minObject



1251
1252
1253
# File 'lib/voruby/votable/1.0/votable.rb', line 1251

def min
  get_element(Min)
end

#min=(m) ⇒ Object

Set the minimum of the value (Min).



1256
1257
1258
# File 'lib/voruby/votable/1.0/votable.rb', line 1256

def min=(m)
  set_element(Min, m)
end

#nullObject



1209
1210
1211
# File 'lib/voruby/votable/1.0/votable.rb', line 1209

def null
  self.node['null']
end

#null=(n) ⇒ Object

Set the value that is used to specify non-existent data.



1215
1216
1217
# File 'lib/voruby/votable/1.0/votable.rb', line 1215

def null=(n)
  @node['null'] = n.to_s
end

#optionsObject

Retrieve the possible values (Option) the column can take on. Returns a HomogeneousNodeList object.



1262
1263
1264
# File 'lib/voruby/votable/1.0/votable.rb', line 1262

def options
  HomogeneousNodeList.new(self.node, xpath_for(Option), Option)
end

#options=(opts) ⇒ Object

Set the possible values the column can take on.

values.options = [Option.new(), ...]


1268
1269
1270
# File 'lib/voruby/votable/1.0/votable.rb', line 1268

def options=(opts)
  self.options.replace(opts)
end

#typeObject



1198
1199
1200
# File 'lib/voruby/votable/1.0/votable.rb', line 1198

def type
  self.node['type']
end

#type=(t) ⇒ Object

Set the scope of values present. Possible values are: legal, actual. Defaults to legal.



1205
1206
1207
# File 'lib/voruby/votable/1.0/votable.rb', line 1205

def type=(t)
  @node['type'] = t.to_s
end