# Gemfile
gem 'opal-rails'
# app/assets/javascripts/application.js
//= require opal
//= require opal_ujs
//= require_tree .
# app/asset/javascripts/my_app.js.opal
puts "Hello, good sirs!" # check the console!
require 'opal-jquery'
Document.ready? do
Element.find('h1').html = 'Manipulating DOM like a sir!'
end
class User
attr_accessor :name
def initialize(name)
@name = name
end
def admin?
@name == 'Admin'
end
end
user = User.new('Bob')
m = user.method(:admin?)
puts m
puts m.call
puts m.is_a?(Array)