Sha256: 50b0a679ac9205aa1885967d36b38d1662a3b2dec8d6d660df5c09b0f112fd96

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

module Omnibar
  class Query

    attr_reader :input

    def initialize(input)
      @input = input
    end

    def self.inherited(subclass)
      Omnibar::App.add_query(subclass)
      super(subclass)
    end

    def preview_text
      res = result
      name = self.class.name.split('::').last
      [name, res] unless result.nil? || result.empty?
    end

    def result
      input
    end

    def copy_to_clipboard(value)
      `echo "#{value}" | xsel -i --clipboard`
    end

    def open_in_browser(url)
      Thread.new { `xdg-open "#{url}" >/dev/null 2>&1` }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omnibar-0.0.5 lib/omnibar/query.rb