Class: VagrantPlugins::ProviderIijGp::Provider
- Inherits:
-
Object
- Object
- VagrantPlugins::ProviderIijGp::Provider
- Defined in:
- lib/vagrant-iijgp/provider.rb
Instance Attribute Summary collapse
-
#machine ⇒ Object
readonly
Returns the value of attribute machine.
Instance Method Summary collapse
-
#action(name) ⇒ Object
A callable action sequence object.
-
#initialize(machine) ⇒ Provider
constructor
A new instance of Provider.
-
#ssh_info ⇒ Hash
SSH information.
- #state ⇒ MachineState
Constructor Details
#initialize(machine) ⇒ Provider
Returns a new instance of Provider.
4 5 6 7 |
# File 'lib/vagrant-iijgp/provider.rb', line 4 def initialize(machine) @logger = Log4r::Logger.new("") @machine = machine end |
Instance Attribute Details
#machine ⇒ Object (readonly)
Returns the value of attribute machine.
8 9 10 |
# File 'lib/vagrant-iijgp/provider.rb', line 8 def machine @machine end |
Instance Method Details
#action(name) ⇒ Object
Returns A callable action sequence object. nil
means that we don’t support the given action.
13 14 15 16 17 18 19 20 21 |
# File 'lib/vagrant-iijgp/provider.rb', line 13 def action(name) method = "action_#{name}" if Action.respond_to? method Action.send(method) else # the specified action is not supported nil end end |
#ssh_info ⇒ Hash
Returns SSH information. For the structure of this hash read the accompanying documentation for this method.
25 26 27 28 |
# File 'lib/vagrant-iijgp/provider.rb', line 25 def ssh_info env = @machine.action('read_ssh_info') env[:machine_ssh_info] end |
#state ⇒ MachineState
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/vagrant-iijgp/provider.rb', line 31 def state env = @machine.action('read_state') state = env[:machine_state] # Translate into short/long descriptions short = I18n.t("vagrant_iijgp.state.#{state}.short") long = I18n.t("vagrant_iijgp.state.#{state}.long") # Return the MachineState object Vagrant::MachineState.new(state, short, long) end |