Class: Aliyun::Odps::ServiceObject

Inherits:
Object
  • Object
show all
Defined in:
lib/aliyun/odps/service_object.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master, _options = {}) ⇒ ServiceObject

Returns a new instance of ServiceObject.



14
15
16
# File 'lib/aliyun/odps/service_object.rb', line 14

def initialize(master, _options = {})
  @master = master
end

Instance Attribute Details

#masterObject (readonly)

Returns the value of attribute master.



12
13
14
# File 'lib/aliyun/odps/service_object.rb', line 12

def master
  @master
end

Class Method Details

.build(master, options = {}) ⇒ Object



22
23
24
# File 'lib/aliyun/odps/service_object.rb', line 22

def self.build(master, options = {})
  service_pool[master] ||= new(master, options)
end

.service_poolObject



18
19
20
# File 'lib/aliyun/odps/service_object.rb', line 18

def self.service_pool
  @service_pool ||= {}
end

Instance Method Details

#clientObject



4
5
6
# File 'lib/aliyun/odps/service_object.rb', line 4

def client
  master.is_a?(Client) ? master : project.client
end

#projectObject



8
9
10
# File 'lib/aliyun/odps/service_object.rb', line 8

def project
  @master.is_a?(Project) ? @master : @master.try(:project)
end