Class: LucidComponent::StylesWrapper

Inherits:
Object
  • Object
show all
Includes:
Native::Wrapper
Defined in:
lib/isomorfeus_preact/lucid_component/styles_wrapper.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/isomorfeus_preact/lucid_component/styles_wrapper.rb', line 21

def method_missing(prop, *args, &block)
  %x{
    let value;
    value = #@native[prop];
    if (value) { return value; }
    else {
      console.warn("Style/Theme key '" + prop + "' returning nil!");
      return #{nil};
    }
  }
end

Instance Method Details

#[](prop) ⇒ Object



17
18
19
# File 'lib/isomorfeus_preact/lucid_component/styles_wrapper.rb', line 17

def [](prop)
  method_missing(prop)
end

#fade_inObject



9
10
11
# File 'lib/isomorfeus_preact/lucid_component/styles_wrapper.rb', line 9

def fade_in
  'fadeIn'
end

#fade_outObject



13
14
15
# File 'lib/isomorfeus_preact/lucid_component/styles_wrapper.rb', line 13

def fade_out
  'fadeOut'
end

#is_wrapped_styleObject



5
6
7
# File 'lib/isomorfeus_preact/lucid_component/styles_wrapper.rb', line 5

def is_wrapped_style
  true
end

#to_hObject



33
34
35
36
37
38
# File 'lib/isomorfeus_preact/lucid_component/styles_wrapper.rb', line 33

def to_h
  %x{
    if (#@props_prop) { return Opal.Hash.$new(#@native.props[#@props_prop]); }
    else { return Opal.Hash.$new(#@native); }
  }
end