Class: Asbru::Components::Savage

Inherits:
Object
  • Object
show all
Extended by:
React::Rails::ViewHelper
Defined in:
lib/asbru/components/savage.rb

Overview

This module is used to generate react components in the views and loads them via method missing without additional checking. It doesn’t offer any benefits over react::rails

Class Method Summary collapse

Class Method Details

.method_missing(method_id, **opts) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/asbru/components/savage.rb', line 15

def method_missing(method_id, **opts)
  if self.respond_to? :method_id
    super
  end

  name_parts = method_id.to_s.split('_')
  namespace = name_parts.shift
  name = name_parts.map(&:capitalize).join('')

  react_component "#{namespace}.#{name}", opts
end

.setupObject



11
12
13
# File 'lib/asbru/components/savage.rb', line 11

def setup
  # No-op
end