Class: ProcessingIde

Inherits:
Object
  • Object
show all
Defined in:
lib/jruby_art/processing_ide.rb

Overview

detects processing preferences.txt, extracts sketchbook_path

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessingIde

Returns a new instance of ProcessingIde.



6
7
8
# File 'lib/jruby_art/processing_ide.rb', line 6

def initialize
  @preferences = File.join(ENV['HOME'], '.processing', 'preferences.txt')
end

Instance Attribute Details

#preferencesObject (readonly)

Returns the value of attribute preferences.



5
6
7
# File 'lib/jruby_art/processing_ide.rb', line 5

def preferences
  @preferences
end

Instance Method Details

#installed?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/jruby_art/processing_ide.rb', line 10

def installed?
  File.exist?(preferences)
end

#sketchbook_pathObject



14
15
16
17
18
19
20
21
22
# File 'lib/jruby_art/processing_ide.rb', line 14

def sketchbook_path
  File.open(preferences, 'r') do |file|
    file.each_line do |line|
      if /sketchbook/.match?(line)
        return line.tap { |sli| sli.slice!('sketchbook.path.three=') }.chomp
      end
    end
  end
end