class Scenic::CommandRecorder::StatementArguments

@api private

Public Class Methods

new(args) click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 5
def initialize(args)
  @args = args.freeze
end

Public Instance Methods

invert_version() click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 21
def invert_version
  StatementArguments.new([view, options_for_revert])
end
remove_version() click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 25
def remove_version
  StatementArguments.new([view, options_without_version])
end
revert_to_version() click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 17
def revert_to_version
  options[:revert_to_version]
end
to_a() click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 29
def to_a
  @args.to_a.dup.delete_if(&:empty?)
end
version() click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 13
def version
  options[:version]
end
view() click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 9
def view
  @args[0]
end

Private Instance Methods

keyword_hash(hash) click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 39
def keyword_hash(hash)
  if Hash.respond_to? :ruby2_keywords_hash
    Hash.ruby2_keywords_hash(hash)
  else
    hash
  end
end
options() click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 35
def options
  @options ||= @args[1] || {}
end
options_for_revert() click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 47
def options_for_revert
  opts = options.clone.tap do |revert_options|
    revert_options[:version] = revert_to_version
    revert_options.delete(:revert_to_version)
  end

  keyword_hash(opts)
end
options_without_version() click to toggle source
# File lib/scenic/command_recorder/statement_arguments.rb, line 56
def options_without_version
  keyword_hash(options.except(:version))
end