Class: IPAccess::Set::GlobalSet
- Inherits:
-
Object
- Object
- IPAccess::Set::GlobalSet
- Includes:
- Singleton
- Defined in:
- lib/ipaccess/patches/generic.rb
Overview
This class is a proxy that raises an exception when any method other than defined in Object class is called. It behaves like NilClass. Do not use this class, use IPAccess::Set.Global constant instead.
Instance Method Summary collapse
-
#==(obj) ⇒ Object
return
true
when compared to IPAccess::Set.Global. - #===(obj) ⇒ Object
-
#global? ⇒ Boolean
This method returns
true
if the current object is IPAccess::Set.Global. -
#inspect ⇒ Object
imitate IPAccess::Set.Global when inspected.
-
#method_missing(name, *args) ⇒ Object
imitate nil even more and disallow direct ACL modifications.
-
#nil? ⇒ Boolean
imitate nil.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
imitate nil even more and disallow direct ACL modifications
226 227 228 229 |
# File 'lib/ipaccess/patches/generic.rb', line 226 def method_missing(name, *args) return nil.method(name).call(*args) if nil.respond_to?(name) raise ArgumentError, "Cannot access global set from object's scope, use IPAccess::Set::Global" end |
Instance Method Details
#==(obj) ⇒ Object
return true
when compared to IPAccess::Set.Global
210 211 212 213 |
# File 'lib/ipaccess/patches/generic.rb', line 210 def ==(obj) return true if obj.object_id == IPAccess::Set::Global.object_id method_missing(:==, obj) end |
#===(obj) ⇒ Object
215 216 217 218 |
# File 'lib/ipaccess/patches/generic.rb', line 215 def ===(obj) return true if obj.object_id == IPAccess::Set::Global.object_id method_missing(:===, obj) end |
#global? ⇒ Boolean
This method returns true
if the current object is IPAccess::Set.Global. Otherwise it returns false
.
207 |
# File 'lib/ipaccess/patches/generic.rb', line 207 def global?; true end |
#inspect ⇒ Object
imitate IPAccess::Set.Global when inspected
221 222 223 |
# File 'lib/ipaccess/patches/generic.rb', line 221 def inspect IPAccess::Set::Global.inspect end |
#nil? ⇒ Boolean
imitate nil
203 |
# File 'lib/ipaccess/patches/generic.rb', line 203 def nil?; true end |