Class: PseudoObject::BasicObject
- Inherits:
- BasicObject
- Defined in:
- lib/pseudo_object/basic_object.rb
Constant Summary collapse
- PSEUDO_CLASS =
::BasicObject
- PSEUDO_INSTANCE_METHODS =
%i/ pseudo_object pseudo_object= pseudo? /
- TypeError =
-
-
-
error
::Class.new(::TypeError) { def initialize(object) = '%s is not a kind of %s class' % [ object.class, PSEUDO_CLASS.name] super() end }
Instance Attribute Summary collapse
-
#pseudo_object ⇒ Object
Returns the value of attribute pseudo_object.
Instance Method Summary collapse
-
#! ⇒ Object
-
pseudo - other.
-
- #!=(other) ⇒ Object
-
#==(other) ⇒ Object
-
pseudo - compare.
-
-
#initialize(source) ⇒ BasicObject
constructor
-
initialize.
-
- #pseudo? ⇒ Boolean
Constructor Details
#initialize(source) ⇒ BasicObject
-
-
-
initialize
28 29 30 |
# File 'lib/pseudo_object/basic_object.rb', line 28 def initialize(source) self.pseudo_object = source end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
-
-
-
private - validate
47 48 49 |
# File 'lib/pseudo_object/basic_object.rb', line 47 def method_missing(method_name, *args, &block) @pseudo_object.__send__(method_name, *args, &block) end |
Instance Attribute Details
#pseudo_object ⇒ Object
Returns the value of attribute pseudo_object.
3 4 5 |
# File 'lib/pseudo_object/basic_object.rb', line 3 def pseudo_object @pseudo_object end |
Instance Method Details
#! ⇒ Object
-
-
-
pseudo - other
78 79 80 |
# File 'lib/pseudo_object/basic_object.rb', line 78 def ! !@pseudo_object end |
#!=(other) ⇒ Object
71 72 73 |
# File 'lib/pseudo_object/basic_object.rb', line 71 def !=(other) !(self == other) end |
#==(other) ⇒ Object
-
-
-
pseudo - compare
62 63 64 65 66 67 68 69 |
# File 'lib/pseudo_object/basic_object.rb', line 62 def ==(other) if other.kind_of?(PSEUDO_CLASS) \ && other == @pseudo_object return true end false end |
#pseudo? ⇒ Boolean
40 41 42 |
# File 'lib/pseudo_object/basic_object.rb', line 40 def pseudo? true end |