Class: PseudoObject::BasicObject
- Inherits:
- BasicObject
- Defined in:
- lib/pseudo_object/model/basic_object.rb
Constant Summary collapse
- PSEUDO_CLASS =
::BasicObject
- PSEUDO_INSTANCE_METHODS =
%i/ pseudo? pseudo_infection= pseudo_infection? pseudo_object pseudo_object= /
- 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(object, infection: true) ⇒ BasicObject
constructor
-
initialize.
-
-
#pseudo? ⇒ Boolean
-
setter, bool.
-
- #pseudo_infection=(bool) ⇒ Object
- #pseudo_infection? ⇒ Boolean
Constructor Details
#initialize(object, infection: true) ⇒ BasicObject
-
-
-
initialize
30 31 32 33 34 35 36 |
# File 'lib/pseudo_object/model/basic_object.rb', line 30 def initialize( object, infection: true ) self.pseudo_object = object self.pseudo_infection = infection end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
-
-
-
private - validate
61 62 63 |
# File 'lib/pseudo_object/model/basic_object.rb', line 61 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/model/basic_object.rb', line 3 def pseudo_object @pseudo_object end |
Instance Method Details
#! ⇒ Object
-
-
-
pseudo - other
92 93 94 |
# File 'lib/pseudo_object/model/basic_object.rb', line 92 def ! !@pseudo_object end |
#!=(other) ⇒ Object
85 86 87 |
# File 'lib/pseudo_object/model/basic_object.rb', line 85 def !=(other) !(self == other) end |
#==(other) ⇒ Object
-
-
-
pseudo - compare
76 77 78 79 80 81 82 83 |
# File 'lib/pseudo_object/model/basic_object.rb', line 76 def ==(other) if other.kind_of?(PSEUDO_CLASS) \ && other == @pseudo_object return true end false end |
#pseudo? ⇒ Boolean
-
-
-
setter, bool
41 42 43 |
# File 'lib/pseudo_object/model/basic_object.rb', line 41 def pseudo? true end |
#pseudo_infection=(bool) ⇒ Object
54 55 56 |
# File 'lib/pseudo_object/model/basic_object.rb', line 54 def pseudo_infection=(bool) @pseudo_infection = !!bool end |
#pseudo_infection? ⇒ Boolean
50 51 52 |
# File 'lib/pseudo_object/model/basic_object.rb', line 50 def pseudo_infection? @pseudo_infection end |