Class: GrADS::Command::TILE

Inherits:
Object
  • Object
show all
Defined in:
lib/grads/command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, width: 6, height: nil, thickness: 3, color: 1, bgcolor: -1)) ⇒ TILE

Returns a new instance of TILE.



978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
# File 'lib/grads/command.rb', line 978

def initialize (type, width: 6, height: nil, thickness: 3, color: 1, bgcolor: -1)
  case type
  when "."
    @type    = 2
  when "\\"
    @type    = 3
  when "/"
    @type    = 4
  when "x"
    @type    = 5
  when "|"
    @type    = 6
  when "-"
    @type    = 7
  when "#", "+"
    @type    = 8
  else
    @type    = type
  end
  @width   = width
  @height  = height || width
  @thickness    = thickness
  @color   = color
  @bgcolor = bgcolor
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



1004
1005
1006
# File 'lib/grads/command.rb', line 1004

def color
  @color
end

#typeObject (readonly)

Returns the value of attribute type.



1004
1005
1006
# File 'lib/grads/command.rb', line 1004

def type
  @type
end

Class Method Details

.next_numberObject



968
969
970
971
972
973
974
# File 'lib/grads/command.rb', line 968

def self.next_number
  @@number += 1
  if @@number > 2047
    reset
  end
  return @@number
end

.resetObject



964
965
966
# File 'lib/grads/command.rb', line 964

def self.reset
  @@number = 0
end

Instance Method Details

#to_aObject



1006
1007
1008
# File 'lib/grads/command.rb', line 1006

def to_a
  return [@type, @width, @height, @thickness, @color, @bgcolor]
end