Class: VORuby::VOTable::V1_0::Max

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

Overview

The maximum value a column may take on.

Constant Summary collapse

ELEMENT_NAME =
'MAX'

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

Create a new maximum value for a column.

max = Max.new(:value => '360', :inclusive => false)


1338
1339
1340
1341
# File 'lib/voruby/votable/1.0/votable.rb', line 1338

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

Instance Method Details

#inclusiveObject



1351
1352
1353
# File 'lib/voruby/votable/1.0/votable.rb', line 1351

def inclusive
  self.node['inclusive']
end

#inclusive=(i) ⇒ Object

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

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


1365
1366
1367
1368
1369
1370
1371
1372
1373
# File 'lib/voruby/votable/1.0/votable.rb', line 1365

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 maximum value is inclusive or not. By default, the maximum is inclusive.

Returns:

  • (Boolean)


1357
1358
1359
# File 'lib/voruby/votable/1.0/votable.rb', line 1357

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

#valueObject



1343
1344
1345
# File 'lib/voruby/votable/1.0/votable.rb', line 1343

def value
  self.node['value']
end

#value=(v) ⇒ Object



1347
1348
1349
# File 'lib/voruby/votable/1.0/votable.rb', line 1347

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