Module: XRB
- Defined in:
- lib/xrb/uri.rb,
lib/xrb/tag.rb,
lib/xrb/error.rb,
lib/xrb/query.rb,
lib/xrb/buffer.rb,
lib/xrb/markup.rb,
lib/xrb/builder.rb,
lib/xrb/strings.rb,
lib/xrb/version.rb,
lib/xrb/entities.rb,
lib/xrb/template.rb,
lib/xrb/reference.rb,
lib/xrb/fallback/query.rb,
lib/xrb/fallback/markup.rb,
lib/xrb/fallback/template.rb,
ext/xrb/xrb.c
Overview
Released under the MIT License. Copyright, 2016-2024, by Samuel Williams.
Defined Under Namespace
Modules: Entities, Fallback, Markup, Native, Query, Script, Strings Classes: Buffer, Builder, Error, FileBuffer, IOBuffer, Location, MarkupString, ParseError, Reference, Tag, Template, URI
Constant Summary collapse
- Parsers =
XRB::Fallback
- VERSION =
"0.11.2"- OUT =
The output variable that will be used in templates:
:_out- BINDING =
The default binding to use when compiling templates.
binding
Class Method Summary collapse
-
.Buffer(value) ⇒ Object
Convert the given value to a buffer.
-
.Reference(path = "", **parameters) ⇒ Object
Generate a URI from a path and user parameters.
-
.URI(path = "", parameters = nil) ⇒ Object
Generate a URI from a path and user parameters.
Class Method Details
.Buffer(value) ⇒ Object
Convert the given value to a buffer.
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/xrb/buffer.rb', line 142 def self.Buffer(value) case value when String Buffer.new(value) when Buffer, FileBuffer, IOBuffer value else value.to_buffer end end |
.Reference(path = "", **parameters) ⇒ Object
Generate a URI from a path and user parameters. The path may contain a #fragment or ‘?query=parameters`.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/xrb/reference.rb', line 94 def self.Reference(path = "", **parameters) base, fragment = path.split("#", 2) path, query_string = base.split("?", 2) if query_string query = Query.parse(Buffer.new(query_string)) else query = {} end query.update(parameters) Reference.new(path, query, fragment: fragment) end |
.URI(path = "", parameters = nil) ⇒ Object
Generate a URI from a path and user parameters. The path may contain a #fragment or ‘?query=parameters`.
94 95 96 97 98 99 |
# File 'lib/xrb/uri.rb', line 94 def self.URI(path = "", parameters = nil) base, fragment = path.split("#", 2) path, query_string = base.split("?", 2) URI.new(path, query_string, fragment, parameters) end |