Class: RubyView

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyview/context.rb,
lib/rubyview.rb,
lib/rubyview/dsl.rb,
lib/rubyview/helpers.rb,
lib/rubyview/railtie.rb,
lib/rubyview/helpers/tag.rb,
lib/rubyview/rails_template.rb

Overview

Empty helpers module with methods to be defined by user. via RubyView.add_helper_method

Defined Under Namespace

Modules: DSL, Helpers Classes: Context, RailsTemplate, Railtie

Class Method Summary collapse

Class Method Details

.add_helper_method(name, &block) ⇒ Object



18
19
20
21
22
# File 'lib/rubyview.rb', line 18

def self.add_helper_method(name, &block)
  RubyView::Helpers.module_eval do
    define_method(name, &block)
  end
end

.evaluate(code, **opts) ⇒ Object



12
13
14
15
16
# File 'lib/rubyview.rb', line 12

def self.evaluate(code, **opts)
  context = RubyView::Context.new
  _results = context.call(code: code)
  _results.dump if opts[:dump]
end

.render(path_to_template) ⇒ Object



7
8
9
10
# File 'lib/rubyview.rb', line 7

def self.render(path_to_template)
  context = RubyView::Context.new
  context.call(file_path: path_to_template)
end