Module: Flex::ActiveModel
- Defined in:
- lib/flex/active_model.rb,
lib/flex/active_model/storage.rb,
lib/flex/active_model/attachment.rb,
lib/flex/active_model/inspection.rb,
lib/flex/active_model/timestamps.rb
Defined Under Namespace
Modules: Attachment, Inspection, Storage, Timestamps Classes: DocumentInvalidError
Instance Attribute Summary collapse
-
#_id ⇒ Object
(also: #id)
readonly
Returns the value of attribute _id.
-
#_version ⇒ Object
readonly
Returns the value of attribute _version.
-
#highlight ⇒ Object
readonly
Returns the value of attribute highlight.
Class Method Summary collapse
Instance Method Summary collapse
- #flex ⇒ Object
- #flex_indexable? ⇒ Boolean
- #flex_source ⇒ Object
- #method_missing(meth, *args, &block) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
42 43 44 |
# File 'lib/flex/active_model.rb', line 42 def method_missing(meth, *args, &block) raw_document.respond_to?(meth) ? raw_document.send(meth) : super end |
Instance Attribute Details
#_id ⇒ Object (readonly) Also known as: id
Returns the value of attribute _id.
4 5 6 |
# File 'lib/flex/active_model.rb', line 4 def _id @_id end |
#_version ⇒ Object (readonly)
Returns the value of attribute _version.
4 5 6 |
# File 'lib/flex/active_model.rb', line 4 def _version @_version end |
#highlight ⇒ Object (readonly)
Returns the value of attribute highlight.
4 5 6 |
# File 'lib/flex/active_model.rb', line 4 def highlight @highlight end |
Class Method Details
.included(base) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/flex/active_model.rb', line 7 def self.included(base) base.class_eval do @flex ||= ClassProxy::Base.new(base) @flex.extend(ClassProxy::ModelSyncer) @flex.extend(ClassProxy::ModelIndexer).init @flex.extend(ClassProxy::ActiveModel).init :params => {:version => true} def self.flex; @flex end flex.synced = [self] include Scopes include ActiveAttr::Model extend ::ActiveModel::Callbacks define_model_callbacks :create, :update, :save, :destroy include Storage::InstanceMethods extend Storage::ClassMethods include Inspection extend Timestamps extend Attachment end end |
Instance Method Details
#flex ⇒ Object
30 31 32 |
# File 'lib/flex/active_model.rb', line 30 def flex @flex ||= InstanceProxy::ActiveModel.new(self) end |
#flex_indexable? ⇒ Boolean
38 39 40 |
# File 'lib/flex/active_model.rb', line 38 def flex_indexable? true end |
#flex_source ⇒ Object
34 35 36 |
# File 'lib/flex/active_model.rb', line 34 def flex_source attributes end |