3

I have setup IRB for my Rails application.

I have used following gems

gem 'sprockets-rails', '<= 3.0.0'
gem 'opal'
gem 'opal-rails', '0.8.0'
gem 'opal-jquery'
gem 'opal-browser'
gem 'opal-irb', github: 'fkchang/opal-irb', require: 'opal-irb-rails'

When I create a class with initialize method like given below

class Test
  def initialize(a)
    puts a
  end
end

Now, I call it like Test.new

It should throw error for wrong number of arguments but it is not throwing.

Here is the screenshot,

enter image description here

Here is the link to my heroku app where I have set it. Heroku Demo app

Nishant Upadhyay
  • 639
  • 7
  • 20
  • I can't replicate your error in your Demo App as I get this: [link to pastebin](http://pastebin.com/GpG2SbAr) – bork Sep 03 '16 at 06:02
  • You have to create any class first, For example, I created one above named Test. I saw your attend and found that you are directly trying Test.new – Nishant Upadhyay Sep 03 '16 at 06:08
  • I can confirm this... try it at http://opalrb.org/try/ and you'll see Opal doesn't respect arity constraints. Not just initialize, but any class method. – SteveTurczyn Sep 03 '16 at 07:29
  • Yes, It is not throwing an error for wrong number of arguments in class method also. Any solution? – Nishant Upadhyay Sep 03 '16 at 11:23

0 Answers0