Sha256: f77ea63ee2ccc61a33d0a5fba92a0c97772e50836183f23ac8d177fbcf64cd39

Contents?: true

Size: 657 Bytes

Versions: 11

Compression:

Stored size: 657 Bytes

Contents

# frozen_string_literal: true

#
# Copyright (c) 2019-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

module Dbee
  module Dsl
    # Provide methods for dealing with introspection of class hierarchies.
    module Reflectable
      # Start at child, end with parent
      def subclasses(base_class_constant)
        ancestors.select { |a| a < base_class_constant }
      end

      # Start at parent, end with child
      def reversed_subclasses(base_class_constant)
        subclasses(base_class_constant).reverse
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
dbee-3.1.0 lib/dbee/dsl/reflectable.rb
dbee-3.0.0 lib/dbee/dsl/reflectable.rb
dbee-2.1.1 lib/dbee/dsl/reflectable.rb
dbee-2.1.0 lib/dbee/dsl/reflectable.rb
dbee-2.1.0.pre.alpha lib/dbee/dsl/reflectable.rb
dbee-2.0.3 lib/dbee/dsl/reflectable.rb
dbee-2.0.2 lib/dbee/dsl/reflectable.rb
dbee-2.0.1 lib/dbee/dsl/reflectable.rb
dbee-2.0.0 lib/dbee/dsl/reflectable.rb
dbee-2.0.0.pre.alpha lib/dbee/dsl/reflectable.rb
dbee-1.2.1 lib/dbee/dsl/reflectable.rb