Class: Lotus::Model::Config::Mapper Private

Inherits:
Object
  • Object
show all
Defined in:
lib/lotus/model/config/mapper.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Read mapping file for mapping DSL

Since:

  • 0.2.0

Constant Summary collapse

EXTNAME =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0

'.rb'

Instance Method Summary collapse

Constructor Details

#initialize(path = nil, &blk) ⇒ Mapper

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Mapper.

Since:

  • 0.2.0



13
14
15
16
17
18
19
20
21
# File 'lib/lotus/model/config/mapper.rb', line 13

def initialize(path=nil, &blk)
  if block_given?
    @blk = blk
  elsif path
    @path = root.join(path)
  else
    raise Lotus::Model::InvalidMappingError.new('You must specify a block or a file.')
  end
end

Instance Method Details

#to_procObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0



23
24
25
26
27
28
29
30
# File 'lib/lotus/model/config/mapper.rb', line 23

def to_proc
  unless @blk
    code = realpath.read
    @blk = Proc.new { eval(code) }
  end

  @blk
end