Class: App::Components::Example

Inherits:
Object
  • Object
show all
Includes:
Opal::Connect
Defined in:
app/components/example.rb

Constant Summary

Constants included from Opal::Connect

Opal::Connect::CLIENT_OPTIONS, Opal::Connect::VERSION

Instance Method Summary collapse

Methods included from Opal::Connect

client_options, included, options, setup

Methods included from Opal::Connect::ConnectPlugins::Base::ClassMethods

#files, #javascript, #plugin, #plugin_paths, #render, #setup, #write_entry_file

Instance Method Details

#displayObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/components/example.rb', line 6

def display
  dom.set! html! {
    html do
      head do
        meta charset: 'utf-8'
      end

      body do
        div 'Example'
      end
    end
  }

  if RUBY_ENGINE == 'opal'
    dom.find('body').append 'cow'
  else
    dom.find('html').append assets([:js, :connect])
  end

  dom
end