Class: Graphene::Vec2
- Inherits:
-
Object
- Object
- Graphene::Vec2
- Defined in:
- lib/graphene1/vec2.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Vec2
constructor
A new instance of Vec2.
- #initialize_raw ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(*args) ⇒ Vec2
Returns a new instance of Vec2.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/graphene1/vec2.rb', line 20 def initialize(*args) super() case args.size when 0 when 1 arg = args[0] case arg when Vec2 init_from_vec2(arg) else = +"source must be Graphene::Vec2: " << "#{arg.inspect}" raise ArgumentError, end when 2 init(*args) else = +"wrong number of arguments " << "(given #{args.size}, expected 0..2)" raise ArgumentError, end end |
Instance Method Details
#initialize_raw ⇒ Object
19 |
# File 'lib/graphene1/vec2.rb', line 19 alias_method :initialize_raw, :initialize |
#to_a ⇒ Object
43 44 45 |
# File 'lib/graphene1/vec2.rb', line 43 def to_a [x, y] end |