Class: PDoc::Models::Argument
Instance Attribute Summary collapse
-
#default_value ⇒ Object
readonly
Returns the value of attribute default_value.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Base
#description, #file, #line_number, #parent, #type
Instance Method Summary collapse
- #attach_to_parent(parent) ⇒ Object
-
#id ⇒ Object
returns the argument’s id in the form method_id:argument_name.
- #optional? ⇒ Boolean
- #to_hash ⇒ Object
- #types ⇒ Object
Methods inherited from Base
#ancestor_of?, #deprecated?, #descendant_of?, #doc_href, #full_name, #initialize, #inspect, instantiate, #normalized_name, #register_on, #short_description, #to_json, #url
Constructor Details
This class inherits a constructor from PDoc::Models::Base
Instance Attribute Details
#default_value ⇒ Object (readonly)
Returns the value of attribute default_value.
5 6 7 |
# File 'lib/pdoc/models/argument.rb', line 5 def default_value @default_value end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/pdoc/models/argument.rb', line 4 def name @name end |
Instance Method Details
#attach_to_parent(parent) ⇒ Object
7 8 9 |
# File 'lib/pdoc/models/argument.rb', line 7 def attach_to_parent(parent) parent.arguments << self end |
#id ⇒ Object
returns the argument’s id in the form method_id:argument_name. So, for example: document.querySelectorAll:cssSelector
14 15 16 |
# File 'lib/pdoc/models/argument.rb', line 14 def id @id ||= "#{parent.id}:#{name}" end |
#optional? ⇒ Boolean
18 19 20 |
# File 'lib/pdoc/models/argument.rb', line 18 def optional? !!@optional end |
#to_hash ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/pdoc/models/argument.rb', line 26 def to_hash { :name => name, :description => description, :default_value => default_value, :optional => optional?, :types => types } end |
#types ⇒ Object
22 23 24 |
# File 'lib/pdoc/models/argument.rb', line 22 def types @types ||= [] end |