Class: PartialCompiler::PartialReader
- Inherits:
-
Object
- Object
- PartialCompiler::PartialReader
- Defined in:
- lib/partial_compiler/partial_reader.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#indentation ⇒ Object
Returns the value of attribute indentation.
-
#locals ⇒ Object
Returns the value of attribute locals.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(original_string, file_called_from) ⇒ PartialReader
constructor
@path: Where the partial file is located @locals: The locals set in the uncompiled file @contents: The actual guts of the partial which will be placed in the compiled file @indentation: The indentation on the line where ‘render partial’ is called.
Constructor Details
#initialize(original_string, file_called_from) ⇒ PartialReader
@path: Where the partial file is located
@locals: The locals set in the uncompiled file
@contents: The actual guts of the partial which will be placed in the compiled file
@indentation: The indentation on the line where 'render partial' is called
13 14 15 16 17 18 19 |
# File 'lib/partial_compiler/partial_reader.rb', line 13 def initialize original_string, file_called_from code_to_eval = original_string.match(PartialCompiler.config[:regex_partial_eval_match])[1] path_to_partial, partial_name, @locals = execute_safe_ruby(code_to_eval) set_path(path_to_partial, partial_name, file_called_from) get_indentation(original_string) set_contents(@indentation) end |
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
6 7 8 |
# File 'lib/partial_compiler/partial_reader.rb', line 6 def contents @contents end |
#indentation ⇒ Object
Returns the value of attribute indentation.
6 7 8 |
# File 'lib/partial_compiler/partial_reader.rb', line 6 def indentation @indentation end |
#locals ⇒ Object
Returns the value of attribute locals.
6 7 8 |
# File 'lib/partial_compiler/partial_reader.rb', line 6 def locals @locals end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/partial_compiler/partial_reader.rb', line 6 def path @path end |