Module: Notcurses::SwigMixins::ToH

Defined in:
lib/notcurses/swig_mixins/to_h.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/notcurses/swig_mixins/to_h.rb', line 5

def self.included(base)
  base.class_eval do
    def to_h
      hash = {}
      meffids = self.class.instance_methods(false).select{|m| m !~ /=$/}

      meffids.each do |m|
        next if (m == :to_h || m =~ /=$/)
        hash[m] = send(m)[:return] if method(m).arity < 1
      end

      hash
    end
  end
end