Class: Chimp::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/right_chimp/objects/ChimpObjects.rb

Overview

This class holds all necessary information regarding an instance and provides a way of executing a script on it via the run_executable method.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServer

Returns a new instance of Server.



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 360

def initialize
  @params = {
    "href"                    => "dummy href",
    "current_instance_href"   => nil,
    "current-instance-href "  => nil,
    "name"                    => "dummy name",
    "nickname"                => "dummy nickname",
    "ip_address"              => nil,
    "ip-address"              => nil,
    "private-ip-address"      => nil,
    "aws-id"                  => "",
    "ec2-instance-type"       => "",
    "dns-name"                => "",
    "locked"                  => "",
    "state"                   => "",
    "datacenter"              => nil
  }
  @object = nil
end

Instance Attribute Details

#objectObject

Returns the value of attribute object.



356
357
358
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 356

def object
  @object
end

#paramsObject

Returns the value of attribute params.



356
357
358
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 356

def params
  @params
end

#run_executable(exec, options) ⇒ Object

In order to run the task, we need to call run_executable on ourselves



407
408
409
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 407

def run_executable
  @run_executable
end

Instance Method Details

#encode_with(coder) ⇒ Object



396
397
398
399
400
401
402
403
404
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 396

def encode_with(coder)
  vars = instance_variables.map{|x| x.to_s}
  vars = vars - ['@object']

  vars.each do |var|
    var_val = eval(var)
    coder[var.gsub('@', '')] = var_val
  end
end

#hrefObject



380
381
382
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 380

def href
  @params['href']
end

#ip_addressObject



392
393
394
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 392

def ip_address
  @params['ip_address']
end

#nameObject



384
385
386
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 384

def name
  @params['name']
end

#nicknameObject



388
389
390
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 388

def nickname
  @params['nickname']
end