Sha256: e4743bd08ff25bf493a85f389ca4e3510227c4af846d0ceecd31a4dfb21f3801
Contents?: true
Size: 922 Bytes
Versions: 21
Compression:
Stored size: 922 Bytes
Contents
require 'hanami/utils/kernel' module Hanami # @since 0.1.0 # @api private module Config # Block or file mapper # # @since 0.1.0 # @api private class Mapper # @api private EXTNAME = '.rb' # @since 0.1.0 # @api private def initialize(root, path, &blk) @path, @blk = path, blk @path = root.join(path) if root && path end # @since 0.1.0 # @api private def to_proc return @blk if @blk code = realpath.read Proc.new { eval(code) } end private # @since 0.1.0 # @api private def realpath Utils::Kernel.Pathname("#{ @path }#{ EXTNAME }").realpath rescue Errno::ENOENT raise ArgumentError, error_message end # @since 0.1.0 # @api private def error_message 'You must specify a block or a file.' end end end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
hanami-1.0.0.beta3 | lib/hanami/config/mapper.rb |