I'm a newbie working on some Ruby tutorials and don't understand how to use the method sendbelow. I can see that the send method reads the value of the attribute iterator, but the Ruby documentation states that the send method accepts the method preceding the colon. So my confusion is how the submit method below interpolates the attribute variable renamed.
module FormatAttributes
def formats(*attributes)
@format_attribute = attributes
end
def format_attributes
@format_attributes
end
end
module Formatter
def display
self.class.format_attributes.each do |attribute|
puts "[#{attribute.to_s.upcase}] #{send(attribute)}"
end
end
end
class Resume
extend FormatAttributes
include Formatter
attr_accessor :name, :phone_number, :email, :experience
formats :name, :phone_number, :email, :experience
end
source
share