Sha256: c7c703ba956ad1642e489b956579cfc7962453d68ce4e69103b3a652c769f0ea

Contents?: true

Size: 912 Bytes

Versions: 36

Compression:

Stored size: 912 Bytes

Contents

module Inch
  module Language
    module Ruby
      module CodeObject
        # a namespace object can have methods and other namespace objects
        # inside itself (e.g. classes and modules)
        class NamespaceObject < Base
          # The wording is a bit redundant, but this means the class and
          # instance attributes of the namespace
          def attributes
            self[:attributes]
          end

          MANY_ATTRIBUTES_THRESHOLD = 5
          def has_many_attributes?
            attributes.size > MANY_ATTRIBUTES_THRESHOLD
          end

          MANY_CHILDREN_THRESHOLD = 20
          def has_many_children?
            children.size > MANY_CHILDREN_THRESHOLD
          end

          def has_methods?
            children.any?(&:method?)
          end

          def pure_namespace?
            children.all?(&:namespace?)
          end
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
inch-0.9.0.rc1 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.8.0 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.8.0.rc2 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.8.0.rc1 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.7.1 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.7.0 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.4 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.3 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.2 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.1 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.0 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.0.rc6 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.0.rc5 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.0.rc4 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.0.rc3 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.0.rc2 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.6.0.rc1 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.5.10 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.5.9 lib/inch/language/ruby/code_object/namespace_object.rb
inch-0.5.8 lib/inch/language/ruby/code_object/namespace_object.rb