Getting Started

Overview

class User
  attr_accessor :name

  def initialize(name)
    @name = name
  end

  def admin?
    @name == 'Admin'
  end
end

user = User.new('Bob')
puts user
puts user.admin?

Try this code in your browser »

Installation

Install Opal from RubyGems:

$ gem install opal

Or include it in your Gemfile for Bundler:

gem 'opal'