Class: Unschema::SchemaIntermediator::Call

Inherits:
Object
  • Object
show all
Defined in:
lib/unschema/schema_intermediator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, *args, &block) ⇒ Call

Returns a new instance of Call.



18
19
20
21
22
23
24
25
# File 'lib/unschema/schema_intermediator.rb', line 18

def initialize(name, *args, &block)
  @name     = name
  @args     = args
  @options  = Hash === args.last ? args.pop : {}
  @calls    = []

  process_block!(block) if block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



31
32
33
# File 'lib/unschema/schema_intermediator.rb', line 31

def method_missing(name, *args, &block)
  @calls << Call.new(name, *args, &block)
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



16
17
18
# File 'lib/unschema/schema_intermediator.rb', line 16

def args
  @args
end

#blockObject (readonly)

Returns the value of attribute block.



16
17
18
# File 'lib/unschema/schema_intermediator.rb', line 16

def block
  @block
end

#callsObject (readonly)

Returns the value of attribute calls.



16
17
18
# File 'lib/unschema/schema_intermediator.rb', line 16

def calls
  @calls
end

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/unschema/schema_intermediator.rb', line 16

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



16
17
18
# File 'lib/unschema/schema_intermediator.rb', line 16

def options
  @options
end

Instance Method Details

#first_argObject



27
28
29
# File 'lib/unschema/schema_intermediator.rb', line 27

def first_arg
  args.first
end