Class: EWS::Model
- Inherits:
-
Object
- Object
- EWS::Model
- Defined in:
- lib/ews/model.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#service ⇒ Object
Returns the value of attribute service.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Model
constructor
A new instance of Model.
- #method_missing(meth, *args) ⇒ Object
- #shallow? ⇒ Boolean
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ews/model.rb', line 19 def method_missing(meth, *args) method_name = meth.to_s if method_name.end_with?('=') attr = method_name.chomp('=').to_sym @attrs[attr] = args.first elsif method_name.end_with?('?') attr = method_name.chomp('?').to_sym @attrs[attr] == true elsif @attrs.has_key?(meth) @attrs[meth] else super meth, *args end end |
Instance Attribute Details
#service ⇒ Object
Returns the value of attribute service.
4 5 6 |
# File 'lib/ews/model.rb', line 4 def service @service end |
Instance Method Details
#shallow? ⇒ Boolean
11 12 13 |
# File 'lib/ews/model.rb', line 11 def shallow? raise NotImplementedError, "Each model must determine when it is shallow." end |