Class: BPM::PluginContext

Inherits:
Object
  • Object
show all
Defined in:
lib/bpm/pipeline/plugin_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pkg, module_id = nil) ⇒ PluginContext

Returns a new instance of PluginContext.



8
9
10
11
12
# File 'lib/bpm/pipeline/plugin_context.rb', line 8

def initialize(pkg, module_id=nil)
  @generating_asset = BPM::GeneratedAsset.generating_asset
  @package = pkg.as_json
  @moduleId = module_id
end

Instance Attribute Details

#moduleIdObject (readonly)

Returns the value of attribute moduleId.



5
6
7
# File 'lib/bpm/pipeline/plugin_context.rb', line 5

def moduleId
  @moduleId
end

#packageObject (readonly)

Returns the value of attribute package.



6
7
8
# File 'lib/bpm/pipeline/plugin_context.rb', line 6

def package
  @package
end

Instance Method Details

#as_jsonObject



22
23
24
25
26
# File 'lib/bpm/pipeline/plugin_context.rb', line 22

def as_json
  { :package => @package,
    :moduleId => @moduleId,
    :settings => settings }
end

#minify_as_jsObject



14
15
16
# File 'lib/bpm/pipeline/plugin_context.rb', line 14

def minify_as_js
  @generating_asset ? @generating_asset.minify_as_js : "CTX.minify=function(body) { return body; }"
end

#settingsObject



18
19
20
# File 'lib/bpm/pipeline/plugin_context.rb', line 18

def settings
  @generating_asset ? @generating_asset.build_settings : {}
end

#to_jsonObject



28
29
30
# File 'lib/bpm/pipeline/plugin_context.rb', line 28

def to_json
  as_json.to_json
end