Class: Inch::Evaluation::NamespaceObject

Inherits:
Base
  • Object
show all
Defined in:
lib/inch/evaluation/namespace_object.rb

Overview

a namespace object can have methods and other namespace objects inside itself (e.g. classes and modules)

Direct Known Subclasses

ClassObject, ModuleObject

Constant Summary collapse

DOC_SCORE =
MAX_SCORE
EXAMPLE_SCORE =
10
MULTIPLE_EXAMPLES_SCORE =
20
RUBY_CORE =
%w(Array Bignum BasicObject Object Module Class Complex NilClass Numeric String Float Fiber FiberError Continuation Dir File Encoding Enumerator StopIteration Enumerator::Generator Enumerator::Yielder Exception SystemExit SignalException Interrupt StandardError TypeError ArgumentError IndexError KeyError RangeError ScriptError SyntaxError LoadError NotImplementedError NameError NoMethodError RuntimeError SecurityError NoMemoryError EncodingError SystemCallError Encoding::CompatibilityError File::Stat IO Hash ENV IOError EOFError ARGF RubyVM RubyVM::InstructionSequence Math::DomainError ZeroDivisionError FloatDomainError Integer Fixnum Data TrueClass FalseClass Mutex Thread Proc LocalJumpError SystemStackError Method UnboundMethod Binding Process::Status Random Range Rational RegexpError Regexp MatchData Symbol Struct ThreadGroup ThreadError Time Encoding::UndefinedConversionError Encoding::InvalidByteSequenceError Encoding::ConverterNotFoundError Encoding::Converter RubyVM::Env) +
%w(Comparable Kernel File::Constants Enumerable Errno FileTest GC ObjectSpace GC::Profiler IO::WaitReadable IO::WaitWritable Marshal Math Process Process::UID Process::GID Process::Sys Signal)

Constants inherited from Base

Base::MAX_SCORE, Base::MIN_SCORE, Base::TAGGED_SCORE

Instance Attribute Summary

Attributes inherited from Base

#max_score, #min_score, #object

Instance Method Summary collapse

Methods inherited from Base

#initialize, #priority, #roles, #score

Constructor Details

This class inherits a constructor from Inch::Evaluation::Base

Instance Method Details

#evaluateObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/inch/evaluation/namespace_object.rb', line 13

def evaluate
  eval_doc
  eval_children
  eval_code_example

  if object.has_many_attributes?
    add_role Role::Namespace::WithManyAttributes.new(object)
  end
  if object.nodoc?
    add_role Role::Object::TaggedAsNodoc.new(object)
  end
  if object.has_unconsidered_tags?
    count = object.unconsidered_tags.size
    add_role Role::Object::Tagged.new(object, TAGGED_SCORE * count)
  end
  if object.in_root?
    add_role Role::Object::InRoot.new(object)
  end
  if object.public?
    add_role Role::Object::Public.new(object)
  end
  if object.protected?
    add_role Role::Object::Protected.new(object)
  end
  if object.private?
    add_role Role::Object::Private.new(object)
  end

  eval_core
end