class PdfScrap::Command::RawCommand

Constants

COMMAND

Attributes

pdf[RW]
x1[RW]
x2[RW]
y1[RW]
y2[RW]

Public Class Methods

command() click to toggle source
# File lib/pdf_scrap/command/raw_command.rb, line 9
def self.command
  raise CommandNotDefinedError if self::COMMAND.empty?
  self::COMMAND
end
exist?() click to toggle source
# File lib/pdf_scrap/command/raw_command.rb, line 14
def self.exist?
  ! self.path.nil?
end
new() click to toggle source
Calls superclass method
# File lib/pdf_scrap/command/raw_command.rb, line 28
def initialize
  super()
  @path = self.class.path
  @params = {}
end
path() click to toggle source
# File lib/pdf_scrap/command/raw_command.rb, line 18
def self.path
  `which #{self.command}`.scan(/(.+)\n/).flatten.first
end

Public Instance Methods

[](param) click to toggle source
# File lib/pdf_scrap/command/raw_command.rb, line 34
def [](param)
  @params[param]
end
[]=(param, value) click to toggle source
# File lib/pdf_scrap/command/raw_command.rb, line 38
def []=(param, value)
  @params[param] = value
end
build() click to toggle source
# File lib/pdf_scrap/command/raw_command.rb, line 42
def build
  command = "#{@path}"
  @params.each do |param, value|
    command << " -#{param} #{value}"
  end
  command
end
execute(*args, &block) click to toggle source
# File lib/pdf_scrap/command/raw_command.rb, line 50
def execute(*args, &block)
  raise MethodNotImplementedError
end
rect=(value) click to toggle source
# File lib/pdf_scrap/command/raw_command.rb, line 54
def rect=(value)
  value = [value].flatten
  self.x1 = value.shift
  self.y1 = value.shift
  self.x2 = value.shift
  self.y2 = value.shift
end