I have a class that has instance variables made of hashes.
require 'hashie'
class CardBrandFees < Hashie::Trash
property :assessments, from: :assessmentss
attr_reader :discover, :visa, :mastercard, :mc_high_ticket, :assessments, :APF
def initialize(ticket)
@ticket = @ticket
@discover = {:assessments => 0.00105, :APF => 0.0195}
@visa = {:assessments => 0.00110, :APF => 0.0195}
@mastercard = {:assessments => 0.00110, :APF => 0.0195}
@mc_high_ticket = {:assessments => 0.00010}
end
end
I would like to make a card brand object and be able to access these hashes via dot notation so:
cardbrand = CardBrandFees.new(ticket)
cardbrand.discover.assessments => 0.00105
I am having considerable difficulty accomplishing this, and not sure its even the most effective way to set this simple class up, I have tried hashie, but cant get that working, does anyone have a simple solution for this situation?
assessmentsandAPFattr_readers