Class: Databasedotcom::Isolated::Scope
- Inherits:
-
Object
- Object
- Databasedotcom::Isolated::Scope
- Defined in:
- lib/databasedotcom/isolated/scope.rb
Overview
Shared functionatily of an isolated scope
Constant Summary collapse
- CLIENT_OPTIONS =
[:client_id,:client_secret]
- AUTHENTICATION_OPTIONS =
[:username, :password, :token]
Class Attribute Summary collapse
-
.binding ⇒ Object
Returns the value of attribute binding.
-
.client ⇒ Object
Returns the value of attribute client.
-
.options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
-
.const_missing(sym) ⇒ Object
Search for missing constants on the current list of sobjects if available.
- .list_sobjects ⇒ Object
- .method_missing(sym, *args) ⇒ Object
- .new(options = {}) ⇒ Object
- .perform(&block) ⇒ Object
Class Attribute Details
.binding ⇒ Object
Returns the value of attribute binding.
16 17 18 |
# File 'lib/databasedotcom/isolated/scope.rb', line 16 def binding @binding end |
.client ⇒ Object
Returns the value of attribute client.
16 17 18 |
# File 'lib/databasedotcom/isolated/scope.rb', line 16 def client @client end |
.options ⇒ Object
Returns the value of attribute options.
16 17 18 |
# File 'lib/databasedotcom/isolated/scope.rb', line 16 def @options end |
Class Method Details
.const_missing(sym) ⇒ Object
Search for missing constants on the current list of sobjects if available
48 49 50 51 52 53 54 |
# File 'lib/databasedotcom/isolated/scope.rb', line 48 def const_missing(sym) if self.list_sobjects.include?(sym.to_s) self.client.materialize(sym.to_s) else super end end |
.list_sobjects ⇒ Object
56 57 58 |
# File 'lib/databasedotcom/isolated/scope.rb', line 56 def list_sobjects @list_sobjects ||= self.client.list_sobjects end |
.method_missing(sym, *args) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/databasedotcom/isolated/scope.rb', line 38 def method_missing(sym,*args) if args.empty? eval(sym.to_s,binding) else context = eval("self",binding) context.send(sym,*args) end end |
.new(options = {}) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/databasedotcom/isolated/scope.rb', line 8 def Scope.new( = {}) Class.new(self).tap do |scope| scope. = scope.client = [:client] end end |
.perform(&block) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/databasedotcom/isolated/scope.rb', line 27 def perform(&block) # self.new.instance_eval(&block) self.binding = block.binding (self.class_eval(block.to_source)).call self.binding = nil # self.class_eval( &eval(block.to_source) ) self end |