class DYI::Script::SimpleScript

Class representing a inline-client-script. The scripting becomes effective only when it is output by SVG format.

Attributes

body[R]

@return [String] body of client scripting

content_type[R]

@return [String] content-type of script

Public Class Methods

new(body, content_type = 'application/ecmascript') click to toggle source

@param [String] body body of client scripting @param [String] content_type content-type of script

# File lib/dyi/script/simple_script.rb, line 38
def initialize(body, content_type = 'application/ecmascript')
  @content_type = content_type
  @body = body
end

Public Instance Methods

append_body(script_body) click to toggle source

Appends script. @param [String] script_body body of client scripting that is appended @since 1.0.2

# File lib/dyi/script/simple_script.rb, line 58
def append_body(script_body)
  if @body.to_s[-1,1] == "\n"
    @body += script_body
  else
    @body = [@body, "\n", script_body].join
  end
end
contents() click to toggle source

@since 1.0.3

# File lib/dyi/script/simple_script.rb, line 67
def contents
  @body
end
has_uri_reference?() click to toggle source

Returns this script includes reference of external script file. @return [Boolean] always returns false

# File lib/dyi/script/simple_script.rb, line 51
def has_uri_reference?
  false
end
include_external_file?() click to toggle source

Returns this script includes reference of external script file. @return [Boolean] always returns false

# File lib/dyi/script/simple_script.rb, line 45
def include_external_file?
  false
end
write_as(formatter, io=$>) click to toggle source

Writes the buffer contents of the object. @param [Formatter::Base] a formatter for export @param [IO] io a buffer that is written

# File lib/dyi/script/simple_script.rb, line 74
def write_as(formatter, io=$>)
  formatter.write_script(self, io)
end