Class: TOKI::T
- Inherits:
-
Object
- Object
- TOKI::T
- Defined in:
- lib/meiou/tokipona.rb
Instance Attribute Summary collapse
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
Instance Method Summary collapse
- #[](k) ⇒ Object
- #define(h = {}) ⇒ Object
-
#initialize(k) ⇒ T
constructor
A new instance of T.
- #keys ⇒ Object
- #pos?(k) ⇒ Boolean
- #to_h ⇒ Object
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
#pos ⇒ Object (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 |
#keys ⇒ Object
22 23 24 |
# File 'lib/meiou/tokipona.rb', line 22 def keys @pos.keys end |
#pos?(k) ⇒ 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_h ⇒ Object
31 32 33 |
# File 'lib/meiou/tokipona.rb', line 31 def to_h @pos end |