Module: Scorched

Defined in:
lib/scorched/error.rb,
lib/scorched/match.rb,
lib/scorched/static.rb,
lib/scorched/options.rb,
lib/scorched/request.rb,
lib/scorched/version.rb,
lib/scorched/response.rb,
lib/scorched/collection.rb,
lib/scorched/controller.rb,
lib/scorched/dynamic_delegate.rb

Defined Under Namespace

Modules: DynamicDelegate Classes: Collection, Controller, Error, Match, Options, Request, Response, Static

Constant Summary collapse

VERSION =
'1.0.0'
TemplateCache =
Tilt::Cache.new

Class Method Summary collapse

Class Method Details

.Collection(accessor_name, append_parent = false) ⇒ Object


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/scorched/collection.rb', line 41

def Collection(accessor_name, append_parent = false)
  m = Module.new
  m.class_eval "class << self\ndef included(klass)\nklass.extend(ClassMethods)\nend\nend\n\nmodule ClassMethods\ndef \#{accessor_name}\[email protected]\#{accessor_name} || begin\nparent = superclass.\#{accessor_name} if superclass.respond_to?(:\#{accessor_name}) && Scorched::Collection === superclass.\#{accessor_name}\[email protected]\#{accessor_name} = Collection.new.parent!(parent)\[email protected]\#{accessor_name}.append_parent = \#{append_parent.inspect}\[email protected]\#{accessor_name}\nend\nend\nend\n\ndef \#{accessor_name}(*args)\nself.class.\#{accessor_name}(*args)\nend\n"
  m
end

.Options(accessor_name) ⇒ Object


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/scorched/options.rb', line 42

def Options(accessor_name)
  m = Module.new
  m.class_eval "class << self\ndef included(klass)\nklass.extend(ClassMethods)\nend\nend\n\nmodule ClassMethods\ndef \#{accessor_name}\[email protected]\#{accessor_name} || begin\nparent = superclass.\#{accessor_name} if superclass.respond_to?(:\#{accessor_name}) && Scorched::Options === superclass.\#{accessor_name}\[email protected]\#{accessor_name} = Options.new.parent!(parent)\nend\nend\nend\n\ndef \#{accessor_name}(*args)\nself.class.\#{accessor_name}(*args)\nend\n"
  m
end