Class: RGhost::Dash

Inherits:
PsObject show all
Includes:
RubyToPs
Defined in:
lib/rghost/dash.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :style => [1,2,3],
  :offset => 0
}

Constants included from RubyToPs

RubyToPs::UTF8_ENCODINGS

Instance Method Summary collapse

Methods included from RubyToPs

#array_to_stack, #hash_to_array, #pack_string, #ps_escape, #string_eval, #to_array, #to_bool, #to_string, #to_string_array

Methods inherited from PsObject

#<<, #call, #graphic_scope, #raw, #set, #to_s

Constructor Details

#initialize(options = {}) ⇒ Dash

Returns a new instance of Dash


44
45
46
47
48
49
50
51
# File 'lib/rghost/dash.rb', line 44

def initialize(options={})
  super(""){}
  if options.is_a?(Numeric) || options.is_a?(Array)
    @options = DEFAULT_OPTIONS.dup.merge(:style => options)
  else
    @options = DEFAULT_OPTIONS.dup.merge(options)
  end
end

Instance Method Details

#psObject


53
54
55
56
# File 'lib/rghost/dash.rb', line 53

def ps
  ary=to_array( [@options[:style]].flatten)
  "#{ary}#{@options[:offset]} setdash"
end