Class: Cpro::Entities::Base
- Inherits:
-
Object
- Object
- Cpro::Entities::Base
- Defined in:
- lib/cpro/entities/base.rb
Direct Known Subclasses
ChangementStatut, DepotFlux, Etablissement, Facture, LigneAnnuaire, LignesAnnuaire, MotifRejet, NoteStatut, ResultatRecherche, StatutFlux, UniteLegale
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(payload = nil) ⇒ Base
constructor
A new instance of Base.
- #to_h ⇒ Object
Constructor Details
#initialize(payload = nil) ⇒ Base
Returns a new instance of Base.
12 13 14 |
# File 'lib/cpro/entities/base.rb', line 12 def initialize(payload = nil) @payload = payload.is_a?(Hash) ? payload : {} end |
Instance Attribute Details
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
10 11 12 |
# File 'lib/cpro/entities/base.rb', line 10 def payload @payload end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
20 21 22 |
# File 'lib/cpro/entities/base.rb', line 20 def ==(other) other.instance_of?(self.class) && other.payload == payload end |
#hash ⇒ Object
25 26 27 |
# File 'lib/cpro/entities/base.rb', line 25 def hash [self.class, payload].hash end |
#to_h ⇒ Object
16 17 18 |
# File 'lib/cpro/entities/base.rb', line 16 def to_h payload end |