Class: Lotus::Model::Config::Mapper Private
- Inherits:
-
Object
- Object
- Lotus::Model::Config::Mapper
- 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
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.
'.rb'
Instance Method Summary collapse
-
#initialize(path = nil, &blk) ⇒ Mapper
constructor
private
A new instance of Mapper.
- #to_proc ⇒ Object private
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.
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_proc ⇒ Object
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.
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 |