Sha256: 2c0d5186216ee3688578bb1e8212f468efa160e9117f617b2983660b52290374
Contents?: true
Size: 559 Bytes
Versions: 4
Compression:
Stored size: 559 Bytes
Contents
module Banken class LoyaltyFinder SUFFIX = "Loyalty" attr_reader :controller def initialize(controller) @controller = controller.to_s end def loyalty loyalty_name.constantize rescue NameError nil end def loyalty! raise NotDefinedError, "unable to find loyalty of nil" unless controller loyalty || raise(NotDefinedError, "unable to find loyalty `#{loyalty_name}` for `#{controller}`") end private def loyalty_name "#{controller.camelize}#{SUFFIX}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
banken-1.0.2 | lib/banken/loyalty_finder.rb |
banken-1.0.1 | lib/banken/loyalty_finder.rb |
banken-1.0.0 | lib/banken/loyalty_finder.rb |
banken-0.1.1 | lib/banken/loyalty_finder.rb |