Module: BivouacHelpers::BaseView
- Defined in:
- lib/bivouac/helpers/view/goh/base.rb
Instance Method Summary collapse
-
#public_to_str(file) ⇒ Object
Return the content of a public file as string.
-
#render(partial, options = {}) ⇒ Object
(also: #partial)
render( :hello, :object => @my_object ) is equivalent to @object = @my_object hello( ).
Instance Method Details
#public_to_str(file) ⇒ Object
Return the content of a public file as string
public_to_str( "/stylesheets/autocomplete.css" )
#=> "div.autocomplete {\n position:absolute;\n..."
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/bivouac/helpers/view/goh/base.rb', line 22 def public_to_str( file ) if file.include? ".." return nil end file = ENV['BIVOUAC_ROOT'] + "/public/" + file open( file ) do |f| data = f.read end return data end |
#render(partial, options = {}) ⇒ Object Also known as: partial
render( :hello, :object => @my_object ) is equivalent to
@object = @my_object
hello( )
9 10 11 12 13 14 |
# File 'lib/bivouac/helpers/view/goh/base.rb', line 9 def render( partial, = {} ) .each do |k, v| self.instance_variable_set( "@#{k.to_s}".to_sym, v ) end self.send( partial.to_sym ) end |