Class: Bri::Match::Class
- Includes:
- Templates::Helpers
- Defined in:
- lib/bri/match/class.rb
Constant Summary collapse
- TEMPLATE =
Bri::Templates::CLASS_DESCRIPTION
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#class_methods ⇒ Object
readonly
Returns the value of attribute class_methods.
-
#constants ⇒ Object
readonly
Returns the value of attribute constants.
-
#description_paragraphs ⇒ Object
readonly
Returns the value of attribute description_paragraphs.
-
#extends ⇒ Object
readonly
Returns the value of attribute extends.
-
#includes ⇒ Object
readonly
Returns the value of attribute includes.
-
#instance_methods ⇒ Object
readonly
Returns the value of attribute instance_methods.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(rdoc_result, store = nil) ⇒ Class
constructor
A new instance of Class.
Methods included from Templates::Helpers
hrule, #print_origin, section_header
Methods inherited from Base
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
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
10 11 12 |
# File 'lib/bri/match/class.rb', line 10 def attributes @attributes end |
#class_methods ⇒ Object (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 |
#constants ⇒ Object (readonly)
Returns the value of attribute constants.
10 11 12 |
# File 'lib/bri/match/class.rb', line 10 def constants @constants end |
#description_paragraphs ⇒ Object (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 |
#extends ⇒ Object (readonly)
Returns the value of attribute extends.
10 11 12 |
# File 'lib/bri/match/class.rb', line 10 def extends @extends end |
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
10 11 12 |
# File 'lib/bri/match/class.rb', line 10 def includes @includes end |
#instance_methods ⇒ Object (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 |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/bri/match/class.rb', line 10 def name @name end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
10 11 12 |
# File 'lib/bri/match/class.rb', line 10 def origin @origin end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/bri/match/class.rb', line 10 def type @type end |