moving files to pc
This commit is contained in:
parent
20559149eb
commit
d05faeac39
|
@ -16,6 +16,17 @@ module Hyde
|
|||
autoload :TRACEHandler, "hyde/probe/http_method"
|
||||
autoload :PATCHHandler, "hyde/probe/http_method"
|
||||
autoload :ServeHandler, "hyde/probe/serve_handler"
|
||||
|
||||
# Binding that provides execution context for Probes.
|
||||
class ProbeBinding
|
||||
include Hyde::DSL::ProbeMethods
|
||||
include Hyde::DSL::CommonMethods
|
||||
|
||||
def initialize(origin)
|
||||
@origin = origin
|
||||
end
|
||||
end
|
||||
|
||||
# Test probe. Also base for all "reactive" nodes.
|
||||
class Probe < Hyde::Node
|
||||
# @param path [Object]
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative "../dsl/probe_methods"
|
||||
require_relative "../dsl/common_methods"
|
||||
|
||||
module Hyde
|
||||
# Binding that provides execution context for Probes.
|
||||
class ProbeBinding
|
||||
include Hyde::DSL::ProbeMethods
|
||||
include Hyde::DSL::CommonMethods
|
||||
|
||||
def initialize(origin)
|
||||
@origin = origin
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,8 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../probe'
|
||||
require_relative 'binding'
|
||||
|
||||
module Hyde
|
||||
# Probe that executes a callback on request
|
||||
class Handler < Hyde::Probe
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../probe'
|
||||
require_relative 'binding'
|
||||
require_relative 'handler'
|
||||
|
||||
module Hyde
|
||||
# Probe that executes callback on a GET
|
||||
class GETHandler < Hyde::Handler
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../probe'
|
||||
require_relative 'binding'
|
||||
|
||||
module Hyde
|
||||
# Probe that sends files from a location
|
||||
class ServeHandler < Hyde::Probe
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Hyde
|
||||
# Adapter class for template engines
|
||||
# @abstract This class does not actually do anything template related.
|
||||
class Template
|
||||
# @param filename [String]
|
||||
# @param context [Binding, nil]
|
||||
# @param locals [Hash{Symbol => Object}, nil]
|
||||
def initialize(filename, context: nil, locals: nil)
|
||||
@data = File.read(filename)
|
||||
@context = context or binding
|
||||
@locals.each do |k, v|
|
||||
@context.local_variable_set(k, v)
|
||||
end
|
||||
end
|
||||
|
||||
# Prepare template before rendering.
|
||||
# (This method is an interface stub)
|
||||
def prepare
|
||||
@template = nil # your template generator goes here
|
||||
end
|
||||
|
||||
# Render template
|
||||
# (This method is an interface stub)
|
||||
def render
|
||||
(@template ||= prepare).render(@context)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue