Class: Jass::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/jass/plugin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, arguments = nil, root = nil) ⇒ Plugin

Returns a new instance of Plugin.



5
6
7
# File 'lib/jass/plugin.rb', line 5

def initialize(name, arguments = nil, root = nil)
  @name, @arguments, @root = name, arguments, root
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



3
4
5
# File 'lib/jass/plugin.rb', line 3

def arguments
  @arguments
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/jass/plugin.rb', line 3

def name
  @name
end

#rootObject (readonly)

Returns the value of attribute root.



3
4
5
# File 'lib/jass/plugin.rb', line 3

def root
  @root
end

Instance Method Details

#to_jsObject



9
10
11
12
# File 'lib/jass/plugin.rb', line 9

def to_js
  args = arguments.respond_to?(:call) ? arguments.call : arguments
  "__plugins__.push(#{name}(#{args}));\n"
end