Class: DocStat::Token
- Inherits:
-
Object
- Object
- DocStat::Token
- Defined in:
- lib/docstat/token.rb
Constant Summary collapse
- METHOD_TYPES =
['clm','clfm','instm','intfm']
- PROPERTY_TYPES =
['instp','intfp']
- TYPE_MAPPING =
{ 'clm' => 'class method', 'clfm' => 'class category method', 'instm' => 'instance method', 'intfm' => 'instance method', 'instp' => 'instance property', 'intfp' => 'instance property' }
Instance Attribute Summary collapse
-
#abstract ⇒ Object
readonly
Returns the value of attribute abstract.
-
#declaration ⇒ Object
readonly
Returns the value of attribute declaration.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#return_value ⇒ Object
readonly
Returns the value of attribute return_value.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #description ⇒ Object
- #documented? ⇒ Boolean
-
#initialize(property_ary) ⇒ Token
constructor
A new instance of Token.
- #method? ⇒ Boolean
- #pretty_type ⇒ Object
- #property? ⇒ Boolean
- #to_hash ⇒ Object
Constructor Details
#initialize(property_ary) ⇒ Token
Returns a new instance of Token.
17 18 19 |
# File 'lib/docstat/token.rb', line 17 def initialize property_ary _, @name, @type, @abstract, @declaration, @return_value = *property_ary end |
Instance Attribute Details
#abstract ⇒ Object (readonly)
Returns the value of attribute abstract.
4 5 6 |
# File 'lib/docstat/token.rb', line 4 def abstract @abstract end |
#declaration ⇒ Object (readonly)
Returns the value of attribute declaration.
4 5 6 |
# File 'lib/docstat/token.rb', line 4 def declaration @declaration end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/docstat/token.rb', line 4 def name @name end |
#return_value ⇒ Object (readonly)
Returns the value of attribute return_value.
4 5 6 |
# File 'lib/docstat/token.rb', line 4 def return_value @return_value end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/docstat/token.rb', line 4 def type @type end |
Instance Method Details
#description ⇒ Object
49 50 51 |
# File 'lib/docstat/token.rb', line 49 def description "#{name} (#{type}) - #{abstract}" end |
#documented? ⇒ Boolean
32 33 34 35 |
# File 'lib/docstat/token.rb', line 32 def documented? # TODO: check parameter docs as well? !((abstract.nil? || abstract.empty?) && (return_value.nil? || return_value.empty?)) end |
#method? ⇒ Boolean
37 38 39 |
# File 'lib/docstat/token.rb', line 37 def method? METHOD_TYPES.include?(type) end |
#pretty_type ⇒ Object
45 46 47 |
# File 'lib/docstat/token.rb', line 45 def pretty_type TYPE_MAPPING[type] end |
#property? ⇒ Boolean
41 42 43 |
# File 'lib/docstat/token.rb', line 41 def property? PROPERTY_TYPES.include?(type) end |
#to_hash ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/docstat/token.rb', line 21 def to_hash { "name" => name, "type" => pretty_type, "abstract" => abstract, "declaration" => declaration, "returns" => return_value, "documented" => documented? } end |