Class: MethodSig::Argument
- Inherits:
-
Object
- Object
- MethodSig::Argument
- Defined in:
- lib/decompiler/method/signature/argument.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #block? ⇒ Boolean
- #default ⇒ Object
-
#initialize(name, is_rest, is_block) ⇒ Argument
constructor
A new instance of Argument.
- #optional? ⇒ Boolean
- #required? ⇒ Boolean
- #rest? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(name, is_rest, is_block) ⇒ Argument
Returns a new instance of Argument.
26 27 28 29 30 |
# File 'lib/decompiler/method/signature/argument.rb', line 26 def initialize(name, is_rest, is_block) @name = name @is_rest = is_rest @is_block = is_block end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/decompiler/method/signature/argument.rb', line 4 def name @name end |
Instance Method Details
#block? ⇒ Boolean
18 19 20 |
# File 'lib/decompiler/method/signature/argument.rb', line 18 def block? return @is_block end |
#default ⇒ Object
22 23 24 |
# File 'lib/decompiler/method/signature/argument.rb', line 22 def default return nil end |
#optional? ⇒ Boolean
10 11 12 |
# File 'lib/decompiler/method/signature/argument.rb', line 10 def optional? return rest? || block? end |
#required? ⇒ Boolean
6 7 8 |
# File 'lib/decompiler/method/signature/argument.rb', line 6 def required? return !optional? end |
#rest? ⇒ Boolean
14 15 16 |
# File 'lib/decompiler/method/signature/argument.rb', line 14 def rest? return @is_rest end |
#to_s ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/decompiler/method/signature/argument.rb', line 32 def to_s if @is_rest then prefix = "*" elsif @is_block then prefix = "&" end if self.default then suffix = "=#{default()}" end return "#{prefix}#{@name}#{suffix}" end |