Class: DepsGrapher::Visualizer::JsOption::Function
- Inherits:
-
Object
- Object
- DepsGrapher::Visualizer::JsOption::Function
- Defined in:
- lib/deps_grapher/visualizer/js_option.rb
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(body:, args: nil) ⇒ Function
constructor
A new instance of Function.
Constructor Details
#initialize(body:, args: nil) ⇒ Function
Returns a new instance of Function.
7 8 9 10 |
# File 'lib/deps_grapher/visualizer/js_option.rb', line 7 def initialize(body:, args: nil) @args = args @body = body end |
Instance Method Details
#as_json ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/deps_grapher/visualizer/js_option.rb', line 12 def as_json(*) <<~JS.split(/$/).map(&:strip).compact_blank.join(";") function(#{Array(@args).join(", ")}) { #{@body} } JS end |