Class: PostsFake::Fake
- Inherits:
-
Object
- Object
- PostsFake::Fake
- Defined in:
- lib/fake.rb
Instance Attribute Summary (collapse)
-
- (Object) comments
Returns the value of attribute comments.
-
- (Object) model
readonly
Returns the value of attribute model.
Instance Method Summary (collapse)
- - (Object) author
- - (Object) id
-
- (Fake) initialize(model, fakes_collection)
constructor
A new instance of Fake.
- - (Object) method_missing(method, *args)
- - (Boolean) respond_to?(*args)
- - (Object) to_s
Constructor Details
- (Fake) initialize(model, fakes_collection)
A new instance of Fake
34 35 36 37 |
# File 'lib/fake.rb', line 34 def initialize(model, fakes_collection) @fakes_collection = fakes_collection @model = model end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(method, *args)
55 56 57 |
# File 'lib/fake.rb', line 55 def method_missing(method, *args) @model.send(method, *args) end |
Instance Attribute Details
- (Object) comments
Returns the value of attribute comments
32 33 34 |
# File 'lib/fake.rb', line 32 def comments @comments end |
- (Object) model (readonly)
Returns the value of attribute model
33 34 35 |
# File 'lib/fake.rb', line 33 def model @model end |
Instance Method Details
- (Object) author
47 48 49 |
# File 'lib/fake.rb', line 47 def @fakes_collection.people_hash[@model.] end |
- (Object) id
39 40 41 |
# File 'lib/fake.rb', line 39 def id @model.id end |
- (Boolean) respond_to?(*args)
51 52 53 |
# File 'lib/fake.rb', line 51 def respond_to?(*args) super(*args) || model.respond_to?(*args) end |
- (Object) to_s
43 44 45 |
# File 'lib/fake.rb', line 43 def to_s @model.id.to_s end |