Class: Attachs::Interpolations

Inherits:
Object
  • Object
show all
Defined in:
lib/attachs/interpolations.rb

Instance Method Summary collapse

Instance Method Details

#add(name, &block) ⇒ Object



16
17
18
# File 'lib/attachs/interpolations.rb', line 16

def add(name, &block)
  registry[name] = block
end

#exist?(name) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/attachs/interpolations.rb', line 4

def exist?(name)
  registry.has_key? name
end

#find(name) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/attachs/interpolations.rb', line 8

def find(name)
  if exist?(name)
    registry[name]
  else
    raise "Interpolation #{name} not found"
  end
end