Sha256: 0ee677f9376bde2f02633a5aee42d2dd43b934df5ce93378ea38531fb4473962

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

module Inch
  module CodeObject
    module Provider
      module YARD
        module Object
          # a namespace object can have methods and other namespace objects
          # inside itself (e.g. classes and modules)
          class NamespaceObject < Base
            def attributes
              object.class_attributes.values + object.instance_attributes.values
            end

            def children_fullnames
              children.map(&:fullname)
            end

            def namespace?
              true
            end

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

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

            # called by MethodObject#getter?
            def child(name)
              children.find { |child| child.name == name } if children
            end

            def children
              object.children.map do |o|
                YARD::Object.for(o)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inch-0.4.10 lib/inch/code_object/provider/yard/object/namespace_object.rb
inch-0.4.9 lib/inch/code_object/provider/yard/object/namespace_object.rb
inch-0.4.8 lib/inch/code_object/provider/yard/object/namespace_object.rb
inch-0.4.7 lib/inch/code_object/provider/yard/object/namespace_object.rb