Class: Preact::Params

Inherits:
Object show all
Includes:
Native::Wrapper
Defined in:
lib/preact/params.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(prop, *args, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/preact/params.rb', line 5

def method_missing(prop, *args, &block)
  %x{
    const p = #@native;
    if (typeof p[prop] === 'undefined') {
      prop = Opal.Preact.lower_camelize(prop);
      if (typeof p[prop] === 'undefined') { return nil; }
    }
    return p[prop];
  }
end