Class: Proc::Arguments
- Inherits:
-
Object
- Object
- Proc::Arguments
- Includes:
- Enumerable
- Defined in:
- lib/decompiler/proc/signature.rb
Instance Method Summary collapse
- #[](idx) ⇒ Object
- #each(&block) ⇒ Object
- #empty_last_arg ⇒ Object
-
#initialize(names, multiple_assignment, rest_arg) ⇒ Arguments
constructor
A new instance of Arguments.
- #multiple_assignment ⇒ Object
- #names ⇒ Object
- #rest_arg ⇒ Object
- #single_assignment ⇒ Object
- #size ⇒ Object
- #unspecified ⇒ Object
Constructor Details
#initialize(names, multiple_assignment, rest_arg) ⇒ Arguments
Returns a new instance of Arguments.
9 10 11 12 13 |
# File 'lib/decompiler/proc/signature.rb', line 9 def initialize(names, multiple_assignment, rest_arg) @names = names @multiple_assignment = multiple_assignment @rest_arg = rest_arg end |
Instance Method Details
#[](idx) ⇒ Object
37 38 39 |
# File 'lib/decompiler/proc/signature.rb', line 37 def [](idx) @names[idx] end |
#each(&block) ⇒ Object
41 42 43 |
# File 'lib/decompiler/proc/signature.rb', line 41 def each(&block) (@names || []).each(&block) end |
#empty_last_arg ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/decompiler/proc/signature.rb', line 53 def empty_last_arg if defined?(VM) and defined?(VM::InstructionSequence) then # YARV return (@rest_arg and @names[-1] == nil) else # pre-YARV return (@names.size == 1 and not @rest_arg) end end |
#multiple_assignment ⇒ Object
29 30 31 |
# File 'lib/decompiler/proc/signature.rb', line 29 def multiple_assignment @multiple_assignment end |
#names ⇒ Object
33 34 35 |
# File 'lib/decompiler/proc/signature.rb', line 33 def names @names end |
#rest_arg ⇒ Object
49 50 51 |
# File 'lib/decompiler/proc/signature.rb', line 49 def rest_arg @rest_arg end |
#single_assignment ⇒ Object
25 26 27 |
# File 'lib/decompiler/proc/signature.rb', line 25 def single_assignment !@multiple_assignment end |
#size ⇒ Object
45 46 47 |
# File 'lib/decompiler/proc/signature.rb', line 45 def size @names.size end |
#unspecified ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/decompiler/proc/signature.rb', line 15 def unspecified if defined?(RubyVM) and defined?(RubyVM::InstructionSequence) then # YARV return @names.length == 0 else # pre-YARV @names.nil? end end |