Class: Miron::Mironfile

Inherits:
Object
  • Object
show all
Defined in:
lib/miron/mironfile.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Mironfile

Returns a new instance of Mironfile.



21
22
23
# File 'lib/miron/mironfile.rb', line 21

def initialize(&block)
  instance_eval(&block)
end

Instance Attribute Details

#appMiron::Mironfile, Nil (readonly)

Returns the contents of the Mironfile in the given dir, if any exists.

Parameters:

  • dir (Pathname)

    The directory where to look for the Mironfile.

Returns:



11
12
13
# File 'lib/miron/mironfile.rb', line 11

def app
  @app
end

Class Method Details

.from_dir(dir) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/miron/mironfile.rb', line 13

def self.from_dir(dir)
  path = dir + 'Mironfile'
  mironfile = Mironfile.new do
    eval(path.read, nil, path.to_s)
  end
  mironfile
end

Instance Method Details

#run(app) ⇒ Object

Takes an argument that is an object that responds to #call and returns a Response.

class Heartbeat def self.call(request) Miron::Response.new(200, { "Content-Type" => "text/plain" }, "OK") end end

run Heartbeat



34
35
36
# File 'lib/miron/mironfile.rb', line 34

def run(app)
  @app = app
end