Class: VORuby::VOTable::V1_1::Min

Inherits:
Base show all
Defined in:
lib/voruby/votable/1.1/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')


1368
1369
1370
1371
# File 'lib/voruby/votable/1.1/votable.rb', line 1368

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

Instance Method Details

#inclusiveObject



1381
1382
1383
# File 'lib/voruby/votable/1.1/votable.rb', line 1381

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'


1395
1396
1397
1398
1399
1400
1401
1402
1403
# File 'lib/voruby/votable/1.1/votable.rb', line 1395

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)


1387
1388
1389
# File 'lib/voruby/votable/1.1/votable.rb', line 1387

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

#valueObject



1373
1374
1375
# File 'lib/voruby/votable/1.1/votable.rb', line 1373

def value
  self.node['value']
end

#value=(v) ⇒ Object



1377
1378
1379
# File 'lib/voruby/votable/1.1/votable.rb', line 1377

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