Class: Torque::PostgreSQL::Attributes::Lazy

Inherits:
BasicObject
Defined in:
lib/torque/postgresql/attributes/lazy.rb,
sig/torque/postgresql/attributes/lazy.rbs

Instance Method Summary collapse

Constructor Details

#initialize(klass, *values) ⇒ Lazy

Returns a new instance of Lazy.

Parameters:

  • klass (Class)
  • values (Object)


8
9
10
# File 'lib/torque/postgresql/attributes/lazy.rb', line 8

def initialize(klass, *values)
  @klass, @values = klass, values
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) {|arg0| ... } ⇒ Object

Parameters:

  • name (Symbol)
  • args (Object)

Yields:

Yield Parameters:

  • arg0

Yield Returns:

  • (Object)

Returns:

  • (Object)


28
29
30
# File 'lib/torque/postgresql/attributes/lazy.rb', line 28

def method_missing(name, *args, &block)
  @klass.new(*@values).send(name, *args, &block)
end

Instance Method Details

#==(other) ⇒ Boolean

Parameters:

  • other (Object)

Returns:

  • (Boolean)


12
13
14
# File 'lib/torque/postgresql/attributes/lazy.rb', line 12

def ==(other)
  other.nil?
end

#__class__ ⇒ singleton(Lazy)

Returns:



24
25
26
# File 'lib/torque/postgresql/attributes/lazy.rb', line 24

def __class__
  Lazy
end

#inspect ⇒ String

Returns:

  • (String)


20
21
22
# File 'lib/torque/postgresql/attributes/lazy.rb', line 20

def inspect
  'nil'
end

#nil? ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/torque/postgresql/attributes/lazy.rb', line 16

def nil?
  true
end