Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #6871

require_relative in ruby 1.9.3 error

Newsgroups comp.lang.ruby
Date 2013-09-01 08:33 -0700
Message-ID <b543c601-e55c-41f4-a162-cb0f5515ac32@googlegroups.com> (permalink)
Subject require_relative in ruby 1.9.3 error
From maasgultekin@gmail.com

Show all headers | View raw


I have ruby 1.9.3 with rvm and i have simple program about shop.
I write require_relative and i take error: https://gist.github.com/maasdesigner/6405171 


init.rb

require_relative "cart.rb"
require_relative "item.rb"

item.rb

class Item
	def initialize(options)
		@price = options[:price]
		@weight = options[:weight]
	end

	attr_reader :price, :weight
	attr_writer :price, :weight
end
puts Item.new({:price => 30}).price



cart.rb

class Cart

	attr_reader :items

	def initialize

		@items = Array.new
		
	end

	def add_item(item)

		@item.push item
		
	end

	def remove_item

		@item.pop
		
	end


Back to comp.lang.ruby | Previous | NextNext in thread | Find similar


Thread

require_relative in ruby 1.9.3 error maasgultekin@gmail.com - 2013-09-01 08:33 -0700
  Re: require_relative in ruby 1.9.3 error DON Who is a ghost <therocketforever@me.com> - 2013-09-22 10:10 -0400

csiph-web