Class: OmniCat::Base
- Inherits:
-
Object
- Object
- OmniCat::Base
- Defined in:
- lib/omnicat/base.rb
Direct Known Subclasses
Classifiers::Base, Classifiers::BayesInternals::Category, Result
Instance Method Summary collapse
-
#to_hash ⇒ Object
Returns Base object as Hash.
Instance Method Details
#to_hash ⇒ Object
Returns Base object as Hash
6 7 8 9 10 11 12 13 14 |
# File 'lib/omnicat/base.rb', line 6 def to_hash hash = {} self.instance_variables.each do |key| if val = instance_variable_get(key) hash[key[1..-1].to_sym] = val.class.to_s.include?('OmniCat') ? val.to_hash : val end end hash end |