Class: Sorcerer::Resource
- Inherits:
-
Object
- Object
- Sorcerer::Resource
- Defined in:
- lib/sorcerer/resource.rb
Defined Under Namespace
Classes: NoHandlerError, NotSexpError, SorcererError, UnexpectedSexpError
Instance Method Summary collapse
-
#initialize(sexp, options = {}) ⇒ Resource
constructor
A new instance of Resource.
- #source ⇒ Object
Constructor Details
#initialize(sexp, options = {}) ⇒ Resource
Returns a new instance of Resource.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sorcerer/resource.rb', line 19 def initialize(sexp, ={}) @sexp = sexp @debug = [:debug] @indent = [:indent] || 0 @indent = 2 if @indent && ! @indent.is_a?(Integer) @multiline = [:multiline] || indenting? @source = '' @word_level = 0 @stack = [] @level = 0 @virgin_line = true end |
Instance Method Details
#source ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/sorcerer/resource.rb', line 33 def source @stack.clear resource(@sexp) if multiline? @source << "\n" unless @source =~ /\n\z/m end @source end |