Class: GRel::NonNegativeInteger

Inherits:
Object
  • Object
show all
Defined in:
lib/grel.rb

Overview

XML Scheam NonNegativeInteger type

Instance Method Summary collapse

Constructor Details

#initialize(number) ⇒ NonNegativeInteger

Just wraps a numeric type



48
49
50
# File 'lib/grel.rb', line 48

def initialize(number)
  @number = number
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blk) ⇒ Object



52
53
54
55
# File 'lib/grel.rb', line 52

def method_missing(name, *args, &blk)
  ret = @number.send(name, *args, &blk)
  ret.is_a?(Numeric) ? MyNum.new(ret) : ret
end

Instance Method Details

#to_sObject



57
58
59
# File 'lib/grel.rb', line 57

def to_s
  "\"#{@number}\"^^<http://www.w3.org/2001/XMLSchema#nonNegativeInteger>"
end