Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Failing for methods inside a module #10

Closed
darkshadow opened this Issue · 1 comment

2 participants

@darkshadow
require 'rubygems'
require 'contracts'

module Test

  include Contracts

  Contract Num, Num => Num
  def self.add(a, b)
     a + b
  end

end

puts Test.add(1, 2)

The above code is producing following error

/home/xxxxx/.rvm/gems/ruby-1.9.3-head/gems/contracts-0.1.1/lib/contracts.rb:143:in block in call_with': uninitialized constant Contract::Func (NameError)
from /home/vamsee/.rvm/gems/ruby-1.9.3-head/gems/contracts-0.1.1/lib/contracts.rb:142:in
each'
from /home/vamsee/.rvm/gems/ruby-1.9.3-head/gems/contracts-0.1.1/lib/contracts.rb:142:in each_with_index'
from /home/vamsee/.rvm/gems/ruby-1.9.3-head/gems/contracts-0.1.1/lib/contracts.rb:142:in
call_with'
from /home/vamsee/.rvm/gems/ruby-1.9.3-head/gems/contracts-0.1.1/lib/decorators.rb:63:in block in add'
from /home/vamsee/.rvm/gems/ruby-1.9.3-head/gems/contracts-0.1.1/lib/decorators.rb:62:in
each'
from /home/vamsee/.rvm/gems/ruby-1.9.3-head/gems/contracts-0.1.1/lib/decorators.rb:62:in add'
from test.rb:15:in

'

@egonSchiele
Owner

Nice catch! Fixed in 891dd9a.

@egonSchiele egonSchiele closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.