Class: Finitio::Compilation

Inherits:
Object
  • Object
show all
Defined in:
lib/finitio/support/compilation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(system = System.new, factory = TypeFactory.new) ⇒ Compilation

Returns a new instance of Compilation.



4
5
6
7
8
# File 'lib/finitio/support/compilation.rb', line 4

def initialize(system = System.new, factory = TypeFactory.new)
  @system  = system
  @factory = factory
  @proxies = []
end

Instance Attribute Details

#factoryObject (readonly)

Returns the value of attribute factory.



9
10
11
# File 'lib/finitio/support/compilation.rb', line 9

def factory
  @factory
end

#proxiesObject (readonly)

Returns the value of attribute proxies.



9
10
11
# File 'lib/finitio/support/compilation.rb', line 9

def proxies
  @proxies
end

#systemObject (readonly)

Returns the value of attribute system.



9
10
11
# File 'lib/finitio/support/compilation.rb', line 9

def system
  @system
end

Class Method Details

.coerce(arg) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/finitio/support/compilation.rb', line 11

def self.coerce(arg)
  case arg
  when NilClass    then new
  when System      then new(arg, arg.factory)
  when TypeFactory then new(System.new, arg)
  else
    raise ArgumentError, "Unable to coerce `#{arg}`"
  end
end

Instance Method Details

#proxy(*args, &bl) ⇒ Object



36
37
38
39
40
# File 'lib/finitio/support/compilation.rb', line 36

def proxy(*args, &bl)
  proxy = factory.proxy(*args, &bl)
  proxies << proxy
  proxy
end

#resolve_proxies!Object



21
22
23
24
25
26
# File 'lib/finitio/support/compilation.rb', line 21

def resolve_proxies!
  proxies.each do |p|
    p.resolve(system)
  end
  self
end