Sha256: 570ab9cf79fa293031816ece44064da4065e58cd702e83c0d51f15cba36399de

Contents?: true

Size: 588 Bytes

Versions: 9

Compression:

Stored size: 588 Bytes

Contents

module Rasti
  class App
    class Utils
      class << self

        def classes_in(namespace, superclass=nil)
          [].tap do |classes|
            namespace.constants.each do |name|
              constant = namespace.const_get name
              if constant.class == Module
                classes_in(constant, superclass).each { |c| classes << c }
              elsif constant.class == Class && (superclass.nil? || constant.ancestors.include?(superclass))
                classes << constant
              end
            end
          end
        end

      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rasti-app-0.1.2 lib/rasti/app/utils.rb
rasti-app-0.1.1 lib/rasti/app/utils.rb
rasti-app-0.1.0 lib/rasti/app/utils.rb
rasti-app-0.0.10 lib/rasti/app/utils.rb
rasti-app-0.0.9 lib/rasti/app/utils.rb
rasti-app-0.0.8 lib/rasti/app/utils.rb
rasti-app-0.0.7 lib/rasti/app/utils.rb
rasti-app-0.0.6 lib/rasti/app/utils.rb
rasti-app-0.0.5 lib/rasti/app/utils.rb