Class: TOKI::T

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(k) ⇒ T

Returns a new instance of T.



8
9
10
11
# File 'lib/meiou/tokipona.rb', line 8

def initialize k
  @id = k
  @pos = {}
end

Instance Attribute Details

#posObject (readonly)

Returns the value of attribute pos.



7
8
9
# File 'lib/meiou/tokipona.rb', line 7

def pos
  @pos
end

Instance Method Details

#[](k) ⇒ Object



19
20
21
# File 'lib/meiou/tokipona.rb', line 19

def [] k
  @pos[k]
end

#define(h = {}) ⇒ Object



25
26
27
28
29
30
# File 'lib/meiou/tokipona.rb', line 25

def define h={}
  h.each_pair do |k,v|
    [v].flatten.each { |e| TOKI.concept[e] = @id }
    @pos[k] = v
  end
end

#keysObject



22
23
24
# File 'lib/meiou/tokipona.rb', line 22

def keys
  @pos.keys
end

#pos?(k) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
# File 'lib/meiou/tokipona.rb', line 12

def pos? k
  if @pos.has_key? k
    return true
  else
    return false
  end
end

#to_hObject



31
32
33
# File 'lib/meiou/tokipona.rb', line 31

def to_h
  @pos
end