Class: VORuby::VOTable::V1_0::Min

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

Overview

A minimum value a column can take on.

Constant Summary collapse

ELEMENT_NAME =
'MIN'

Instance Attribute Summary

Attributes inherited from XML::Object::Base

#node

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) ⇒ Min

Create a new minimum value for a column.

min = Min.new(:value => '0')


1288
1289
1290
1291
# File 'lib/voruby/votable/1.0/votable.rb', line 1288

def initialize(defn=nil)
  super(defn)
  self.inclusive = true if !self.inclusive
end

Instance Method Details

#inclusiveObject



1301
1302
1303
# File 'lib/voruby/votable/1.0/votable.rb', line 1301

def inclusive
  self.node['inclusive']
end

#inclusive=(i) ⇒ Object

Set whether the minimum value is inclusive or not. Takes a boolean value or a yes/no string.

min.inclusive = false # or...
min.inclusive = 'no'


1315
1316
1317
1318
1319
1320
1321
1322
1323
# File 'lib/voruby/votable/1.0/votable.rb', line 1315

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

#inclusive?Boolean

Check whether the minimum value is inclusive or not. By default, the minimum is inclusive.

Returns:

  • (Boolean)


1307
1308
1309
# File 'lib/voruby/votable/1.0/votable.rb', line 1307

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

#valueObject



1293
1294
1295
# File 'lib/voruby/votable/1.0/votable.rb', line 1293

def value
  self.node['value']
end

#value=(v) ⇒ Object



1297
1298
1299
# File 'lib/voruby/votable/1.0/votable.rb', line 1297

def value=(v)
  @node['value'] = v.to_s
end