Class: RGhost::Show
- Includes:
- RubyToPs
- Defined in:
- lib/rghost/show.rb
Overview
Writes a text on the current row or point with align.
Constant Summary collapse
- DEFAULT_OPTIONS =
{:tag => :default_font, :align => :show_left}
Instance Attribute Summary collapse
-
#align ⇒ Object
Returns the value of attribute align.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text, options = { :align=>:show_left, :tag => :default_font, :color => 0 }) ⇒ Show
constructor
A new instance of Show.
- #ps ⇒ Object
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(text, options = { :align=>:show_left, :tag => :default_font, :color => 0 }) ⇒ Show
Returns a new instance of Show.
69 70 71 72 |
# File 'lib/rghost/show.rb', line 69 def initialize(text,={ :align=>:show_left, :tag => :default_font, :color => 0 } ) @text = text @options=DEFAULT_OPTIONS.dup.merge() end |
Instance Attribute Details
#align ⇒ Object
Returns the value of attribute align.
7 8 9 |
# File 'lib/rghost/show.rb', line 7 def align @align end |
#tag ⇒ Object
Returns the value of attribute tag.
7 8 9 |
# File 'lib/rghost/show.rb', line 7 def tag @tag end |
#text ⇒ Object
Returns the value of attribute text.
7 8 9 |
# File 'lib/rghost/show.rb', line 7 def text @text end |
Instance Method Details
#ps ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rghost/show.rb', line 74 def ps rtext=RGhost::PsObject.new #rtext.raw Color.create(@options[:color] || 0) if @options[:with] || @options[:tag] f="_#{@options[:with] || @options[:tag]}" rtext.raw f end rtext.raw RGhost::Color.create(@options[:color]) if @options[:color] rtext.raw to_string(@text) rtext.raw @options[:align] rtext.graphic_scope end |