Sha256: ee2b923794a4c78768301f4eecbf14709412ba18de7f9eeeb11d8be933b9ec2c
Contents?: true
Size: 743 Bytes
Versions: 3
Compression:
Stored size: 743 Bytes
Contents
# frozen_string_literal: true module Mongoid module Orderable module Generators class Helpers < Base def generate self_class = klass klass.class_eval <<~KLASS, __FILE__, __LINE__ + 1 def orderable_top(field = nil) field ||= default_orderable_field #{self_class}.orderable_configs[field][:base] end def orderable_field(field = nil) field ||= default_orderable_field #{self_class}.orderable_configs[field][:field] end KLASS generate_method(:orderable_inherited_class) do self_class.orderable_configs.any? {|_field, conf| conf[:inherited] } ? self_class : self.class end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems