Class: Yalphabetize::OrderCheckers::Custom
- Defined in:
- lib/yalphabetize/order_checkers/custom.rb
Instance Method Summary collapse
- #compare(string, other_string) ⇒ Object
-
#initialize(allowed_order) ⇒ Custom
constructor
A new instance of Custom.
Methods inherited from Base
Constructor Details
#initialize(allowed_order) ⇒ Custom
Returns a new instance of Custom.
6 7 8 9 |
# File 'lib/yalphabetize/order_checkers/custom.rb', line 6 def initialize(allowed_order) super() @allowed_order = allowed_order end |
Instance Method Details
#compare(string, other_string) ⇒ Object
11 12 13 |
# File 'lib/yalphabetize/order_checkers/custom.rb', line 11 def compare(string, other_string) allowed_order.index(string) <=> allowed_order.index(other_string) end |