Sha256: d90b5d9f8055dbae5bcc4bc0d22bee4ce0efc37c490fdf007bdd7a903160d54d

Contents?: true

Size: 180 Bytes

Versions: 54

Compression:

Stored size: 180 Bytes

Contents

class Adder
  def initialize
    @addends = []
  end
  
  def <<(val)
    @addends << val
  end
  
  def sum
    @addends.inject(0) { |sum_so_far, val| sum_so_far + val }
  end
end

Version data entries

54 entries across 54 versions & 9 rubygems

Version Path
dchelimsky-rspec-1.1.10 examples/stories/adder.rb
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/examples/stories/adder.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/examples/stories/adder.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/examples/stories/adder.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/examples/stories/adder.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/adder.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/adder.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/adder.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/adder.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/adder.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/adder.rb
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec/examples/stories/adder.rb
picolena-0.1.0 rails_plugins/rspec/examples/stories/adder.rb
picolena-0.1.1 rails_plugins/rspec/examples/stories/adder.rb
picolena-0.1.2 rails_plugins/rspec/examples/stories/adder.rb
picolena-0.1.4 rails_plugins/rspec/examples/stories/adder.rb
picolena-0.1.3 rails_plugins/rspec/examples/stories/adder.rb
picolena-0.1.5 rails_plugins/rspec/examples/stories/adder.rb
pictrails-0.5.0 vendor/plugins/rspec/examples/stories/adder.rb
radiant-0.6.5.1 vendor/plugins/rspec/examples/stories/adder.rb