Class: RailsBestPractices::Core::Nil

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_best_practices/core/nil.rb

Overview

Fake nil.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &block) ⇒ Object

return self.



32
33
34
# File 'lib/rails_best_practices/core/nil.rb', line 32

def method_missing(method_sym, *arguments, &block)
  self
end

Instance Method Details

#array_sizeObject

array_size is 0.



12
13
14
# File 'lib/rails_best_practices/core/nil.rb', line 12

def array_size
  0
end

#blank?Boolean

true

Returns:

  • (Boolean)


27
28
29
# File 'lib/rails_best_practices/core/nil.rb', line 27

def blank?
  true
end

#hash_sizeObject

hash_size is 0.



7
8
9
# File 'lib/rails_best_practices/core/nil.rb', line 7

def hash_size
  0
end

#present?Boolean

false

Returns:

  • (Boolean)


22
23
24
# File 'lib/rails_best_practices/core/nil.rb', line 22

def present?
  false
end

#to_sObject

return self for to_s.



17
18
19
# File 'lib/rails_best_practices/core/nil.rb', line 17

def to_s
  self
end