class Commandc::Text

@since since 0.0.1

Attributes

device[RW]
open[RW]
text[RW]

Public Class Methods

new(text, device, open) click to toggle source
# File lib/commandc/text.rb, line 9
def initialize(text, device, open)
  @text = escape(text)
  @device = escape(device)
  @open = open
end

Public Instance Methods

copy() click to toggle source
# File lib/commandc/text.rb, line 15
def copy
  if open
    `open "command-c://x-callback-url/copyAndOpenURL?url=#{text}&deviceName=#{device}"`
  else
    `open "command-c://x-callback-url/copyText?text=#{text}&deviceName=#{device}"`
  end
end
escape(text_to_escape) click to toggle source
# File lib/commandc/text.rb, line 23
def escape(text_to_escape)
  URI.escape(text_to_escape)
end