Class: Natto::MeCabStruct
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Natto::MeCabStruct
- Defined in:
- lib/natto/struct.rb
Overview
MeCabStruct
is a general base class for FFI::Struct
objects in
the Natto
module. Please refer to mecab.h
in the source code
distribution.
Direct Known Subclasses
Instance Method Summary collapse
-
#method_missing(attr_name) ⇒ Object
Provides accessor methods for the members of the MeCab struct.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(attr_name) ⇒ Object
Provides accessor methods for the members of the MeCab struct.
16 17 18 19 20 21 |
# File 'lib/natto/struct.rb', line 16 def method_missing(attr_name) member_sym = attr_name.id2name.to_sym self[member_sym] rescue ArgumentError # `member_sym` field doesn't exist. raise(NoMethodError.new("undefined method '#{attr_name}' for #{self}")) end |