Class: Barn::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/barn/factory.rb

Overview

maybe Proc already defines __FILENAME__ and __LINENUMBER__

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}, &blk) ⇒ Factory

Returns a new instance of Factory.



9
10
11
12
13
# File 'lib/barn/factory.rb', line 9

def initialize(name, options = {}, &blk)
  @name    = name
  @options = options
  @blk     = blk
end

Instance Attribute Details

#filenameObject

help with debugging where something was defined



5
6
7
# File 'lib/barn/factory.rb', line 5

def filename
  @filename
end

#lineObject

help with debugging where something was defined



5
6
7
# File 'lib/barn/factory.rb', line 5

def line
  @line
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/barn/factory.rb', line 7

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/barn/factory.rb', line 7

def options
  @options
end

Instance Method Details

#call(env) ⇒ Object

Returns built object



16
17
18
# File 'lib/barn/factory.rb', line 16

def call(env)
  @blk.call(env)
end