Class: Intent::Args

Inherits:
Object
  • Object
show all
Defined in:
lib/intent/args.rb

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Args

Returns a new instance of Args.



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/intent/args.rb', line 3

def initialize(input)
  @arity = input.length

  unless empty?
    case @arity
    when 1 then interpret_args_unary(input[0])
    when 2 then interpret_args_binary(input[0], input[1])
    when 3 then interpret_args_ternary(input[0], input[1], input[2])
    end
  end
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/intent/args.rb', line 15

def empty?
  @arity == 0
end