Class: MitoNattoNode
- Inherits:
-
Object
show all
- Defined in:
- lib/mito_natto_node.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/mito_natto_node.rb', line 18
def method_missing(method_name)
[ELEMENTS_JA, ELEMENTS_EN].each do |elements|
if elements.include?(method_name.to_s)
return features[elements.find_index(method_name.to_s)]
end
end
super
end
|
Instance Attribute Details
#mecab_node ⇒ Object
Returns the value of attribute mecab_node.
8
9
10
|
# File 'lib/mito_natto_node.rb', line 8
def mecab_node
@mecab_node
end
|
Instance Method Details
#features ⇒ Object
14
15
16
|
# File 'lib/mito_natto_node.rb', line 14
def features
@features ||= mecab_node.feature.split(',')
end
|
#respond_to?(method_name) ⇒ Boolean
27
28
29
30
31
32
33
34
|
# File 'lib/mito_natto_node.rb', line 27
def respond_to?(method_name)
[ELEMENTS_JA, ELEMENTS_EN].each do |elements|
if elements.include?(method_name.to_s)
return true
end
end
super
end
|
#surface ⇒ Object
10
11
12
|
# File 'lib/mito_natto_node.rb', line 10
def surface
mecab_node.surface
end
|