Class: Falcore::NullObject

Inherits:
BasicObject
Defined in:
lib/falcore/null_object.rb

Constant Summary collapse

ARRAY =
[]
INTEGER =
0
FLOAT =
0.0
STRING =
''
INSPECT =
'nil'

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



52
53
54
# File 'lib/falcore/null_object.rb', line 52

def method_missing(m, *args, &block)
  self
end

Instance Method Details

#inspectObject



48
49
50
# File 'lib/falcore/null_object.rb', line 48

def inspect
  INSPECT.dup
end

#nil?Boolean Also known as: empty?

Returns:

  • (Boolean)


27
28
29
# File 'lib/falcore/null_object.rb', line 27

def nil?
  true
end

#to_aObject



32
33
34
# File 'lib/falcore/null_object.rb', line 32

def to_a
  ARRAY.dup
end

#to_fObject



40
41
42
# File 'lib/falcore/null_object.rb', line 40

def to_f
  FLOAT
end

#to_iObject



36
37
38
# File 'lib/falcore/null_object.rb', line 36

def to_i
  INTEGER
end

#to_sObject



44
45
46
# File 'lib/falcore/null_object.rb', line 44

def to_s
  STRING.dup
end