Created
May 12, 2018 13:57
-
-
Save mleszcz/6c1d1d5b9ed2f15708b8c3f0fcb4397b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OrderRepor | |
attr_accessor :attributes | |
def initialize(various_attributes) | |
@attributes = various_attributes | |
end | |
def print_out | |
puts "Summary title" | |
yield @attributes | |
end | |
end | |
report = OrderRepor.new(item_name: "Awesome ebike", total_cost: 2000.0) | |
report.print_out do |attrs| | |
puts attrs[:item_name] | |
end | |
# Summary title | |
# Awesome ebike | |
report.print_out do |attrs| | |
puts attrs[:item_name] | |
puts attrs[:total_cost] | |
end | |
# Summary title | |
# Awesome ebike | |
# 2000.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment