Class: AutoTypeDoc::Argument
- Inherits:
-
Object
- Object
- AutoTypeDoc::Argument
- Defined in:
- lib/auto_type_doc/argument.rb
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #add_type(type) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name:, kind:, position:) ⇒ Argument
constructor
A new instance of Argument.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, kind:, position:) ⇒ Argument
Returns a new instance of Argument.
5 6 7 8 9 10 |
# File 'lib/auto_type_doc/argument.rb', line 5 def initialize(name:, kind:, position:) @name = name.to_s @kind = kind.to_s @types = Hash.new(0) @position = position end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
3 4 5 |
# File 'lib/auto_type_doc/argument.rb', line 3 def kind @kind end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/auto_type_doc/argument.rb', line 3 def name @name end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
3 4 5 |
# File 'lib/auto_type_doc/argument.rb', line 3 def position @position end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
3 4 5 |
# File 'lib/auto_type_doc/argument.rb', line 3 def types @types end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 |
# File 'lib/auto_type_doc/argument.rb', line 17 def ==(other) name == other.name end |
#add_type(type) ⇒ Object
12 13 14 15 |
# File 'lib/auto_type_doc/argument.rb', line 12 def add_type(type) type = type.to_s types[type] += 1 end |
#eql?(other) ⇒ Boolean
21 22 23 |
# File 'lib/auto_type_doc/argument.rb', line 21 def eql?(other) self == other end |
#hash ⇒ Object
25 26 27 |
# File 'lib/auto_type_doc/argument.rb', line 25 def hash name.hash end |
#to_h ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/auto_type_doc/argument.rb', line 29 def to_h { name: name, types: types, kind: kind, position: position } end |