Class: Nockr::Atom

Inherits:
Noun
  • Object
show all
Defined in:
lib/nockr/atom.rb

Instance Attribute Summary collapse

Attributes inherited from Noun

#n

Instance Method Summary collapse

Methods inherited from Noun

#==, #nonify, #to_tuples

Constructor Details

#initialize(i) ⇒ Atom

Returns a new instance of Atom.

Raises:

  • (ArgumentError)


7
8
9
10
# File 'lib/nockr/atom.rb', line 7

def initialize(i)
  raise ArgumentError.new("an Atom must be initialized with a Natural Number") unless i.is_a? Integer
  @i = i
end

Instance Attribute Details

#iObject (readonly)

Returns the value of attribute i.



5
6
7
# File 'lib/nockr/atom.rb', line 5

def i
  @i
end

Instance Method Details

#aryObject



12
13
14
# File 'lib/nockr/atom.rb', line 12

def ary
  [self.i]
end

#at(index:) ⇒ Object



16
17
18
# File 'lib/nockr/atom.rb', line 16

def at(index:)
  self
end

#atom?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/nockr/atom.rb', line 20

def atom?
  true
end

#cell?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/nockr/atom.rb', line 24

def cell?
  false
end