Sha256: c151eafda3c9d37c1e9af88d3978ef1a4f85ee9e9c52d0a593396b9d05ae795d

Contents?: true

Size: 551 Bytes

Versions: 5

Compression:

Stored size: 551 Bytes

Contents

module Runbook
  class AirbrusshContext
    attr_reader :history, :current_task_name

    def initialize(config=Airbrussh.configuration)
      @history = []
    end

    def register_new_command(command)
      hist_entry = command.to_s
      first_execution = history.last != hist_entry
      history << hist_entry if first_execution
      first_execution
    end

    def position(command)
      history.rindex(command.to_s)
    end

    def set_current_task_name(task_name)
      @current_task_name = task_name
      history.clear
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
careacademy-runbook-1.2.0 lib/runbook/airbrussh_context.rb
runbook-1.1.0 lib/runbook/airbrussh_context.rb
runbook-1.0.0 lib/runbook/airbrussh_context.rb
runbook-0.16.1 lib/runbook/airbrussh_context.rb
runbook-0.16.0 lib/runbook/airbrussh_context.rb