Class: VORuby::VOTable::V1_1::Max

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


1418
1419
1420
1421
# File 'lib/voruby/votable/1.1/votable.rb', line 1418

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

Instance Method Details

#inclusiveObject



1431
1432
1433
# File 'lib/voruby/votable/1.1/votable.rb', line 1431

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'


1445
1446
1447
1448
1449
1450
1451
1452
1453
# File 'lib/voruby/votable/1.1/votable.rb', line 1445

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)


1437
1438
1439
# File 'lib/voruby/votable/1.1/votable.rb', line 1437

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

#valueObject



1423
1424
1425
# File 'lib/voruby/votable/1.1/votable.rb', line 1423

def value
  self.node['value']
end

#value=(v) ⇒ Object



1427
1428
1429
# File 'lib/voruby/votable/1.1/votable.rb', line 1427

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