Class: Juggle::Op::Closure

Inherits:
Base
  • Object
show all
Defined in:
lib/juggle/ops/closure.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#opts

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Juggle::Op::Base

Instance Attribute Details

#envObject

Returns the value of attribute env.



5
6
7
# File 'lib/juggle/ops/closure.rb', line 5

def env
  @env
end

#jugObject

Returns the value of attribute jug.



5
6
7
# File 'lib/juggle/ops/closure.rb', line 5

def jug
  @jug
end

Class Method Details

.default_optsObject



7
8
9
10
11
# File 'lib/juggle/ops/closure.rb', line 7

def self.default_opts
  {
    :nowrap => true
  }
end

Instance Method Details

#make(&blk) ⇒ Object



13
14
15
# File 'lib/juggle/ops/closure.rb', line 13

def make(&blk)
  self.jug = Juggle::Jug.new(opts, &blk)
end

#manifestObject



25
26
27
# File 'lib/juggle/ops/closure.rb', line 25

def manifest
  jug.manifest
end

#renderObject



17
18
19
20
21
22
23
# File 'lib/juggle/ops/closure.rb', line 17

def render
  [
    '(function(){',
    jug.render.gsub(/^/, ' '*Juggle.settings[:indent]),
    '}).call(this);'
  ].join("\n")
end