Module: Trevl
- Defined in:
- lib/trevl.rb,
lib/trevl/errors.rb,
lib/trevl/version.rb,
lib/trevl/notebook.rb,
lib/trevl/renderer.rb,
lib/trevl/processor.rb,
lib/trevl/validator.rb,
lib/trevl/data_source.rb,
lib/trevl/configuration.rb,
lib/trevl/core_ext/hash.rb,
lib/trevl/html_renderer.rb,
lib/trevl/template_store.rb,
lib/trevl/data_source/api.rb,
lib/trevl/data_source/base.rb,
lib/trevl/data_source/cube.rb,
lib/trevl/highcharts_asset.rb,
lib/trevl/notebook/display.rb,
lib/trevl/auth/bearer_token.rb,
lib/trevl/data_source/static.rb,
lib/trevl/renderer/transform.rb,
lib/trevl/renderer/ref_parser.rb,
lib/trevl/renderer/data_fetcher.rb
Defined Under Namespace
Modules: Auth, CoreExt, DataSource, HighchartsAsset Classes: Configuration, DataSourceError, Error, HtmlRenderer, Notebook, ParseError, Processor, RenderError, Renderer, TemplateStore, ValidationError, Validator
Constant Summary collapse
- GEM_ROOT =
File.("..", __dir__)
- VERSION =
"0.1.0"
Class Method Summary collapse
- .configuration ⇒ Object
-
.configure {|configuration| ... } ⇒ Object
--- Configuration ---.
- .examples ⇒ Object
- .logger ⇒ Object
-
.parse(yaml_string) ⇒ Object
--- Core API ---.
-
.render(yaml_string, params: {}, data: nil, data_sources: {}) ⇒ Object
data: inline rows for this render call (=> rows), wrapped in a Static source internally; answers any api name and components without one.
- .render_to_html(yaml_string, params: {}, data: nil, data_sources: {}, width: 800, height: 400) ⇒ Object
-
.reset! ⇒ Object
--- Lifecycle ---.
-
.schema_reference ⇒ Object
--- AI tooling ---.
- .template_store ⇒ Object
- .validate(yaml_string) ⇒ Object
Class Method Details
.configuration ⇒ Object
35 36 37 |
# File 'lib/trevl.rb', line 35 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
--- Configuration ---
31 32 33 |
# File 'lib/trevl.rb', line 31 def configure yield(configuration) end |
.examples ⇒ Object
72 73 74 |
# File 'lib/trevl.rb', line 72 def examples @examples ||= load_examples end |
.logger ⇒ Object
39 |
# File 'lib/trevl.rb', line 39 def logger = configuration.logger |
.parse(yaml_string) ⇒ Object
--- Core API ---
44 45 46 |
# File 'lib/trevl.rb', line 44 def parse(yaml_string) Processor.new(yaml_string) end |
.render(yaml_string, params: {}, data: nil, data_sources: {}) ⇒ Object
data: inline rows for this render call (=> rows), wrapped in a Static source internally; answers any api name and components without one. data_sources: per-render sources (=> instance). Both take precedence over the global DataSource registry.
56 57 58 59 |
# File 'lib/trevl.rb', line 56 def render(yaml_string, params: {}, data: nil, data_sources: {}) components = parse(yaml_string).components || [] components.filter_map { |c| Renderer.new(c, params, data: data, data_sources: data_sources).render } end |
.render_to_html(yaml_string, params: {}, data: nil, data_sources: {}, width: 800, height: 400) ⇒ Object
61 62 63 64 |
# File 'lib/trevl.rb', line 61 def render_to_html(yaml_string, params: {}, data: nil, data_sources: {}, width: 800, height: 400) HtmlRenderer.new(width: width, height: height) .render(yaml_string, params: params, data: data, data_sources: data_sources) end |
.reset! ⇒ Object
--- Lifecycle ---
78 79 80 81 82 |
# File 'lib/trevl.rb', line 78 def reset! @configuration = Configuration.new @schema_reference = nil @examples = nil end |
.schema_reference ⇒ Object
--- AI tooling ---
68 69 70 |
# File 'lib/trevl.rb', line 68 def schema_reference @schema_reference ||= File.read(File.join(GEM_ROOT, "llms.txt")) end |
.template_store ⇒ Object
40 |
# File 'lib/trevl.rb', line 40 def template_store = configuration.template_store |