Class: Sorcerer::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/sorcerer/signature.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sexp) ⇒ Signature

Returns a new instance of Signature.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sorcerer/signature.rb', line 6

def initialize(sexp)
  @normal_args = sexp[1]
  @default_args = sexp[2]
  @rest_arg = sexp[3]
  if ruby2_style_param_list?(sexp)
    @keyword_args = sexp[5]
    @opts_arg = sexp[6]
    @block_arg = sexp[7]
  else
    @block_arg = sexp[5]
  end
end

Instance Attribute Details

#block_argObject (readonly)

Returns the value of attribute block_arg.



4
5
6
# File 'lib/sorcerer/signature.rb', line 4

def block_arg
  @block_arg
end

#default_argsObject (readonly)

Returns the value of attribute default_args.



4
5
6
# File 'lib/sorcerer/signature.rb', line 4

def default_args
  @default_args
end

#keyword_argsObject (readonly)

Returns the value of attribute keyword_args.



4
5
6
# File 'lib/sorcerer/signature.rb', line 4

def keyword_args
  @keyword_args
end

#normal_argsObject (readonly)

Returns the value of attribute normal_args.



4
5
6
# File 'lib/sorcerer/signature.rb', line 4

def normal_args
  @normal_args
end

#opts_argObject (readonly)

Returns the value of attribute opts_arg.



4
5
6
# File 'lib/sorcerer/signature.rb', line 4

def opts_arg
  @opts_arg
end

#rest_argObject (readonly)

Returns the value of attribute rest_arg.



4
5
6
# File 'lib/sorcerer/signature.rb', line 4

def rest_arg
  @rest_arg
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
# File 'lib/sorcerer/signature.rb', line 19

def empty?
  missing?(normal_args) &&
    missing?(default_args) &&
    missing?(rest_arg) &&
    missing?(keyword_args) &&
    missing?(opts_arg) &&
    missing?(block_arg)
end