Class: Hanami::Config::Mapper Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/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.

Block or file mapper

Since:

  • 0.1.0

Direct Known Subclasses

Routes

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.1.0

'.rb'

Instance Method Summary collapse

Constructor Details

#initialize(root, path, &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.1.0



17
18
19
20
# File 'lib/hanami/config/mapper.rb', line 17

def initialize(root, path, &blk)
  @path, @blk = path, blk
  @path = root.join(path) if root && path
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.1.0



24
25
26
27
28
29
# File 'lib/hanami/config/mapper.rb', line 24

def to_proc
  return @blk if @blk

  code = realpath.read
  Proc.new { eval(code) }
end