Class: Bri::Match::Class

Inherits:
Base
  • Object
show all
Includes:
Templates::Helpers
Defined in:
lib/bri/match/class.rb

Constant Summary collapse

TEMPLATE =
Bri::Templates::CLASS_DESCRIPTION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Templates::Helpers

hrule, #print_origin, section_header

Methods inherited from Base

#to_s

Constructor Details

#initialize(rdoc_result, store = nil) ⇒ Class

Returns a new instance of Class.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bri/match/class.rb', line 14

def initialize( rdoc_result, store = nil )
  class_methods, instance_methods = rdoc_result.method_list.
                                                select {|m| m.visibility == :public }.
                                                partition { |m| m.singleton }
  @type                   = rdoc_result.type
  @name                   = "#{rdoc_result.full_name}"
  @name                   << " < #{rdoc_result.superclass}" if @type == "class" && rdoc_result.superclass
  @description_paragraphs = build_description( rdoc_result.comment.parts )
  @includes               = rdoc_result.includes.map(&:full_name)
  @extends                = rdoc_result.extends.map(&:full_name)
  @attributes             = rdoc_result.attributes.map { |a| "#{a.name} (#{a.rw})" }
  @class_methods          = class_methods.map(&:name)
  @instance_methods       = instance_methods.map(&:name)
  @origin                 = store&.friendly_path
  @constants = rdoc_result.constants.map do |c|
                 c.value ? "#{c.name} = #{c.value}" : c.name
               end
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def attributes
  @attributes
end

#class_methodsObject (readonly)

Returns the value of attribute class_methods.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def class_methods
  @class_methods
end

#constantsObject (readonly)

Returns the value of attribute constants.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def constants
  @constants
end

#description_paragraphsObject (readonly)

Returns the value of attribute description_paragraphs.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def description_paragraphs
  @description_paragraphs
end

#extendsObject (readonly)

Returns the value of attribute extends.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def extends
  @extends
end

#includesObject (readonly)

Returns the value of attribute includes.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def includes
  @includes
end

#instance_methodsObject (readonly)

Returns the value of attribute instance_methods.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def instance_methods
  @instance_methods
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def name
  @name
end

#originObject (readonly)

Returns the value of attribute origin.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def origin
  @origin
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/bri/match/class.rb', line 10

def type
  @type
end