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.



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 355

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.



351
352
353
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 351

def object
  @object
end

#paramsObject

Returns the value of attribute params.



351
352
353
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 351

def params
  @params
end

#run_executable(exec, options) ⇒ Object

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



402
403
404
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 402

def run_executable
  @run_executable
end

Instance Method Details

#encode_with(coder) ⇒ Object



391
392
393
394
395
396
397
398
399
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 391

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



375
376
377
# File 'lib/right_chimp/objects/ChimpObjects.rb', line 375

def href
  @params['href']
end

#ip_addressObject



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

def ip_address
  @params['ip_address']
end

#nameObject



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

def name
  @params['name']
end

#nicknameObject



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

def nickname
  @params['nickname']
end