Class: Vident::Internals::TargetBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/vident/internals/target_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ TargetBuilder

Returns a new instance of TargetBuilder.



8
9
10
11
# File 'lib/vident/internals/target_builder.rb', line 8

def initialize(*args)
  @args = args
  @when_proc = nil
end

Instance Method Details

#to_declarationObject



18
19
20
# File 'lib/vident/internals/target_builder.rb', line 18

def to_declaration
  Declaration.new(args: @args.freeze, when_proc: @when_proc, meta: {}.freeze)
end

#when(callable = nil, &block) ⇒ Object



13
14
15
16
# File 'lib/vident/internals/target_builder.rb', line 13

def when(callable = nil, &block)
  @when_proc = block || callable
  self
end