Skip to content

Instantly share code, notes, and snippets.

@Gurpartap
Created August 12, 2012 13:52
Show Gist options
  • Save Gurpartap/f9381fb2a163837d77b3 to your computer and use it in GitHub Desktop.
Save Gurpartap/f9381fb2a163837d77b3 to your computer and use it in GitHub Desktop.
class CustomValues
attr_accessor :values
def initialize(*values)
self.values = values
end
def update
values.each do |value|
yield(value) if block_given?
end
end
end
s1 = CustomValues.new(1,2,3,4,5)
s1.update do |value|
puts value
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment