Sha256: f8eac617104e94cfeb5d3a443f2c00effadd28d0e736b15e21423935e00a594f

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

module Inch
  module Language
    module Ruby
      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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inch-0.5.0.rc5 lib/inch/language/ruby/provider/yard/object/namespace_object.rb
inch-0.5.0.rc4 lib/inch/language/ruby/provider/yard/object/namespace_object.rb