Class: Shared::Configuration Abstract
- Defined in:
- lib/vas/shared/configuration.rb
Overview
A configuration file in an instance
Direct Known Subclasses
LiveConfiguration, PendingConfiguration, TcServer::Configuration, WebServer::Configuration
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
The configuration’s path.
-
#size ⇒ Integer
readonly
The configuration’s size.
Attributes inherited from Resource
Instance Method Summary collapse
-
#content {|chunk| ... } ⇒ void
Retrieves the configuration’s content from the server and passes it to the block.
-
#initialize(location, client, instance_type, instance_class) ⇒ Configuration
constructor
A new instance of Configuration.
-
#instance ⇒ Instance
The instance that owns the configuration.
-
#reload ⇒ void
Reloads the configuration’s details from the server.
-
#to_s ⇒ String
A string representation of the configuration.
Constructor Details
#initialize(location, client, instance_type, instance_class) ⇒ Configuration
Returns a new instance of Configuration.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vas/shared/configuration.rb', line 35 def initialize(location, client, instance_type, instance_class) super(location, client) @instance_class = instance_class @instance_location = Util::LinkUtils.get_link_href(details, instance_type) @content_location = Util::LinkUtils.get_link_href(details, 'content') @path = details['path'] end |
Instance Attribute Details
#path ⇒ String (readonly)
Returns the configuration’s path.
23 24 25 |
# File 'lib/vas/shared/configuration.rb', line 23 def path @path end |
#size ⇒ Integer (readonly)
Returns the configuration’s size.
26 27 28 |
# File 'lib/vas/shared/configuration.rb', line 26 def size @size end |
Instance Method Details
#content {|chunk| ... } ⇒ void
This method returns an undefined value.
Retrieves the configuration’s content from the server and passes it to the block
59 60 61 |
# File 'lib/vas/shared/configuration.rb', line 59 def content(&block) client.get_stream(@content_location, &block) end |
#instance ⇒ Instance
Returns the instance that owns the configuration.
64 65 66 |
# File 'lib/vas/shared/configuration.rb', line 64 def instance @instance ||= @instance_class.new(@instance_location, client) end |
#reload ⇒ void
This method returns an undefined value.
Reloads the configuration’s details from the server
49 50 51 52 |
# File 'lib/vas/shared/configuration.rb', line 49 def reload super @size = details['size'] end |
#to_s ⇒ String
Returns a string representation of the configuration.
69 70 71 |
# File 'lib/vas/shared/configuration.rb', line 69 def to_s "#<#{self.class} name='#@path' size='#@size'>" end |