Skip to content

Instantly share code, notes, and snippets.

@qrprat77
Created September 10, 2014 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qrprat77/ad76a460d2d309863afa to your computer and use it in GitHub Desktop.
Save qrprat77/ad76a460d2d309863afa to your computer and use it in GitHub Desktop.
I don't think my class is right
module Read_r
class Entry
attr_accessor :name, :recorder, :favbook, :fiction, :minreadmon, :minreadtues, :minreadweds, :minreadthurs, :minreadoth
def initialize(options = {})
self.name = options[:name]
self.recorder = options[:recorder]
self.favbook = options[:favbook]
options.keys.each do |minread| # from this block on I think is messy
# I want to check if an option is one of the minread* accesssors above
# It seems to me that I'm doing this whole method wrong, duplicating a lot
# of code.
self.send(((minread.to_s).+ "=").to_sym, options[minread]) if minread.to_s.include?("minread")
end
end
def save(filename)
end
end # Entry class
end #read_r module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment