class Yalphabetize::OrderCheckers::Base
Public Class Methods
Source
# File lib/yalphabetize/order_checkers/base.rb, line 6 def self.new_for(node) node_keys = node.children.select.each_with_index do |_, i| i.even? end.map(&:value) matched_allowed_order = Yalphabetize.config['allowed_orders']&.find do |allowed_order| (node_keys - allowed_order).empty? end matched_allowed_order ? Custom.new(matched_allowed_order) : new end
Public Instance Methods
Source
# File lib/yalphabetize/order_checkers/base.rb, line 18 def ordered?(string, other_string) !compare(string, other_string).positive? end
Private Instance Methods
Source
# File lib/yalphabetize/order_checkers/base.rb, line 24 def alphabetical_comparison(string, other_string) string.downcase <=> other_string.downcase end