Class: Multisync::Definition::Template

Inherits:
Object
  • Object
show all
Includes:
Dsl
Defined in:
lib/multisync/definition/template.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Dsl

#check_from, #check_to, #default, #from, #group, #include, #only_if, #options, #sync, #template, #to

Constructor Details

#initialize(name, &block) ⇒ Template

Returns a new instance of Template.



21
22
23
24
25
# File 'lib/multisync/definition/template.rb', line 21

def initialize name, &block
  @name = name
  self.class.register self
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

The block the template holds



19
20
21
# File 'lib/multisync/definition/template.rb', line 19

def block
  @block
end

#nameObject (readonly)

The name of the template



16
17
18
# File 'lib/multisync/definition/template.rb', line 16

def name
  @name
end

Class Method Details

.lookup(name) ⇒ Object



11
12
13
# File 'lib/multisync/definition/template.rb', line 11

def self.lookup name
  @registered.find {|instance| instance.name == name }
end

.register(instance) ⇒ Object



7
8
9
# File 'lib/multisync/definition/template.rb', line 7

def self.register instance
  @registered << instance
end