Class: Banken::LoyaltyFinder
- Inherits:
-
Object
- Object
- Banken::LoyaltyFinder
- Defined in:
- lib/banken/loyalty_finder.rb
Constant Summary collapse
- SUFFIX =
"Loyalty"
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
-
#initialize(controller) ⇒ LoyaltyFinder
constructor
A new instance of LoyaltyFinder.
- #loyalty ⇒ Object
- #loyalty! ⇒ Object
Constructor Details
#initialize(controller) ⇒ LoyaltyFinder
Returns a new instance of LoyaltyFinder.
7 8 9 |
# File 'lib/banken/loyalty_finder.rb', line 7 def initialize(controller) @controller = controller.to_s end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
5 6 7 |
# File 'lib/banken/loyalty_finder.rb', line 5 def controller @controller end |
Instance Method Details
#loyalty ⇒ Object
11 12 13 14 15 |
# File 'lib/banken/loyalty_finder.rb', line 11 def loyalty loyalty_name.constantize rescue NameError nil end |
#loyalty! ⇒ Object
17 18 19 20 |
# File 'lib/banken/loyalty_finder.rb', line 17 def loyalty! raise NotDefinedError, "unable to find loyalty of nil" unless controller loyalty || raise(NotDefinedError, "unable to find loyalty `#{loyalty_name}` for `#{controller}`") end |