Module: RIO::Ext

Defined in:
lib/rio/ext.rb,
lib/rio/ext.rb,
lib/rio/ext.rb,
lib/rio/ext.rb,
lib/rio/ext.rb,
lib/rio/ext/csv.rb,
lib/rio/ext/csv.rb,
lib/rio/ext/csv.rb,
lib/rio/ext/yaml.rb,
lib/rio/ext/mp3info.rb,
lib/rio/ext/yaml/doc.rb,
lib/rio/ext/yaml/tie.rb,
lib/rio/ext/yaml/tie.rb,
lib/rio/ext/yaml/tie.rb,
lib/rio/ext/splitlines.rb,
lib/rio/ext/splitlines.rb

Overview

:nodoc: all

Defined Under Namespace

Modules: CSV, Cx, Input, Mp3Info, Output, SplitLines, YAML Classes: Extension, Extensions

Constant Summary collapse

OUTPUT_SYMS =
Util::build_sym_hash(CSV::Output.instance_methods + YAML::Output.instance_methods)
@@extensions =
{}

Class Method Summary collapse

Class Method Details

.add(cl, meth) ⇒ Object



48
49
50
51
# File 'lib/rio/ext.rb', line 48

def add(cl,meth)
  @@extensions[cl] ||= []
  @@extensions[cl].push(meth)
end

.became(obj) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/rio/ext.rb', line 57

def became(obj)
  if @@extensions[obj.class]
    @@extensions[obj.class].each { |meth|
      meth[obj]
    }
  end
end

.extend_state(state_class, ext_module) ⇒ Object



52
53
54
55
# File 'lib/rio/ext.rb', line 52

def extend_state(state_class,ext_module)
  ext_proc = proc{ |obj| obj.extend(ext_module) }
  RIO::Ext.add(state_class,ext_proc)
end