Class: DaggerRuby::DaggerObject
- Inherits:
-
Object
- Object
- DaggerRuby::DaggerObject
- Defined in:
- lib/dagger_ruby/dagger_object.rb
Direct Known Subclasses
CacheVolume, Container, Directory, File, GitRef, GitRepository, Host, Secret, Service, Socket
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#query_builder ⇒ Object
readonly
Returns the value of attribute query_builder.
Class Method Summary collapse
Instance Method Summary collapse
- #chain_operation(field, args = {}) ⇒ Object
- #id ⇒ Object
-
#initialize(query_builder = nil, client = nil) ⇒ DaggerObject
constructor
A new instance of DaggerObject.
Constructor Details
#initialize(query_builder = nil, client = nil) ⇒ DaggerObject
Returns a new instance of DaggerObject.
10 11 12 13 |
# File 'lib/dagger_ruby/dagger_object.rb', line 10 def initialize(query_builder = nil, client = nil) @query_builder = query_builder || QueryBuilder.new(self.class.root_field_name) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/dagger_ruby/dagger_object.rb', line 8 def client @client end |
#query_builder ⇒ Object (readonly)
Returns the value of attribute query_builder.
8 9 10 |
# File 'lib/dagger_ruby/dagger_object.rb', line 8 def query_builder @query_builder end |
Class Method Details
.from_id(id, client) ⇒ Object
82 83 84 85 86 |
# File 'lib/dagger_ruby/dagger_object.rb', line 82 def from_id(id, client) query = QueryBuilder.new(root_field_name) query.load_from_id(id) new(query, client) end |
.root_field_name ⇒ Object
88 89 90 |
# File 'lib/dagger_ruby/dagger_object.rb', line 88 def root_field_name name.split("::").last.downcase end |
Instance Method Details
#chain_operation(field, args = {}) ⇒ Object
15 16 17 18 |
# File 'lib/dagger_ruby/dagger_object.rb', line 15 def chain_operation(field, args = {}) new_query = @query_builder.chain_operation(field, args) self.class.new(new_query, @client) end |
#id ⇒ Object
20 21 22 |
# File 'lib/dagger_ruby/dagger_object.rb', line 20 def id @id ||= get_scalar("id") end |