Class: Postsvg::Model::Operators::Color::Setgray

Inherits:
Postsvg::Model::Operator show all
Defined in:
lib/postsvg/model/operators/color.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postsvg::Model::Operator

#accept, #operator?, register_as

Constructor Details

#initialize(gray:) ⇒ Setgray

Returns a new instance of Setgray.



10
11
12
13
# File 'lib/postsvg/model/operators/color.rb', line 10

def initialize(gray:)
  @gray = gray
  freeze
end

Instance Attribute Details

#grayObject (readonly)

Returns the value of attribute gray.



9
10
11
# File 'lib/postsvg/model/operators/color.rb', line 9

def gray
  @gray
end

Class Method Details

.from_operands(stack) ⇒ Object



14
15
16
# File 'lib/postsvg/model/operators/color.rb', line 14

def self.from_operands(stack)
  new(gray: stack.pop_number)
end