Class: Flok::TransitionCompilerController

Inherits:
Object
  • Object
show all
Defined in:
lib/flok/transition_compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, ctx, &block) ⇒ TransitionCompilerController

Returns a new instance of TransitionCompilerController.



268
269
270
271
272
273
274
275
# File 'lib/flok/transition_compiler.rb', line 268

def initialize name, ctx, &block
  @name = name
  @ctx = ctx
  @spots = ['main']
  @macros = {}

  self.instance_eval(&block)
end

Instance Attribute Details

#macrosObject

Returns the value of attribute macros.



267
268
269
# File 'lib/flok/transition_compiler.rb', line 267

def macros
  @macros
end

#nameObject

Returns the value of attribute name.



267
268
269
# File 'lib/flok/transition_compiler.rb', line 267

def name
  @name
end

#spots(*spots) ⇒ Object

Names of spots



283
284
285
# File 'lib/flok/transition_compiler.rb', line 283

def spots
  @spots
end

Instance Method Details

#action(name, &block) ⇒ Object

Pass through action



288
289
290
# File 'lib/flok/transition_compiler.rb', line 288

def action name, &block
  @ctx.action self, name, &block
end

#macro(name, &block) ⇒ Object

Create an action macro



278
279
280
# File 'lib/flok/transition_compiler.rb', line 278

def macro name, &block
  @macros[name] = block
end