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.



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

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

Instance Attribute Details

#blockObject (readonly)

The block the template holds



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

def block
  @block
end

#nameObject (readonly)

The name of the template



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

def name
  @name
end

Class Method Details

.lookup(name) ⇒ Object



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

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

.register(instance) ⇒ Object



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

def self.register instance
  @registered << instance
end