Class: Style

Inherits:
Object
  • Object
show all
Defined in:
lib/grada/gnuplot.rb

Constant Summary collapse

STYLES =
[:ls, :lt, :lw, :lc, :pt, :ps, :fs]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Style

Returns a new instance of Style.

Yields:

  • (_self)

Yield Parameters:

  • _self (Style)

    the object that the method was called on



137
138
139
140
141
142
143
144
# File 'lib/grada/gnuplot.rb', line 137

def initialize
  STYLES.each do |style|
    send("#{style}=", nil)
  end

  yield self if block_given?

end

Instance Attribute Details

#fillObject Also known as: fs

Returns the value of attribute fill.



112
113
114
# File 'lib/grada/gnuplot.rb', line 112

def fill
  @fill
end

#indexObject

Returns the value of attribute index.



112
113
114
# File 'lib/grada/gnuplot.rb', line 112

def index
  @index
end

#linecolorObject Also known as: lc

Returns the value of attribute linecolor.



112
113
114
# File 'lib/grada/gnuplot.rb', line 112

def linecolor
  @linecolor
end

#linestyleObject Also known as: ls

Returns the value of attribute linestyle.



112
113
114
# File 'lib/grada/gnuplot.rb', line 112

def linestyle
  @linestyle
end

#linetypeObject Also known as: lt

Returns the value of attribute linetype.



112
113
114
# File 'lib/grada/gnuplot.rb', line 112

def linetype
  @linetype
end

#linewidthObject Also known as: lw

Returns the value of attribute linewidth.



112
113
114
# File 'lib/grada/gnuplot.rb', line 112

def linewidth
  @linewidth
end

#pointsizeObject Also known as: ps

Returns the value of attribute pointsize.



112
113
114
# File 'lib/grada/gnuplot.rb', line 112

def pointsize
  @pointsize
end

#pointtypeObject Also known as: pt

Returns the value of attribute pointtype.



112
113
114
# File 'lib/grada/gnuplot.rb', line 112

def pointtype
  @pointtype
end

Class Method Details

.increment_indexObject



132
133
134
135
# File 'lib/grada/gnuplot.rb', line 132

def self.increment_index
  @index ||= 0
  @index += 1
end

Instance Method Details

#to_sObject



146
147
148
149
150
151
152
153
154
# File 'lib/grada/gnuplot.rb', line 146

def to_s
  str = ' '

  STYLES.each do |style|
    str += " #{style} #{send(style)}" if send(style) 
  end

  str == ' ' ? '' : str
end