Class: Container::NullObject

Inherits:
Object
  • Object
show all
Defined in:
lib/container.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



120
121
122
# File 'lib/container.rb', line 120

def method_missing(method_sym, *arguments, &block)
  return NullObject.new
end

Class Method Details

.wrap(instance) ⇒ Object



124
125
126
127
128
129
130
131
132
# File 'lib/container.rb', line 124

def self.wrap(instance)
  class << instance
    def method_missing(method_sym, *arguments, &block)
      return NullObject.new
    end
  end

  instance
end

Instance Method Details

#!Object



116
117
118
# File 'lib/container.rb', line 116

def !
  true
end

#blank?Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/container.rb', line 104

def blank?
  true
end

#empty?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/container.rb', line 100

def empty?
  true
end

#nil?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/container.rb', line 96

def nil?
  true
end

#to_sObject



108
109
110
# File 'lib/container.rb', line 108

def to_s
  ""
end

#to_strObject



112
113
114
# File 'lib/container.rb', line 112

def to_str
  ""
end