Class: Config
- Inherits:
-
Object
- Object
- Config
- Defined in:
- lib/jruby_art/config.rb
Overview
Configuration class
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(conf = {}) ⇒ Config
constructor
A new instance of Config.
- #load_config ⇒ Object
- #write_to_file ⇒ Object
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/jruby_art/config.rb', line 9 def config @config end |
Instance Method Details
#check ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/jruby_art/config.rb', line 34 def check load_config puts "JRubyArt version #{JRubyArt::VERSION}" puts 'Approximates to Processing-4.0' puts "processing ide = #{config.fetch('processing_ide', false)}" puts "library_path = #{config.fetch('library_path', File.join(HOME, '.jruby_art'))}" puts "template = #{config.fetch('template', 'bare')}" puts "java_args = #{config.fetch('java_args', '')}" puts "MAX_WATCH = #{config.fetch('MAX_WATCH', 32)}" puts "JRUBY = #{config.fetch('JRUBY', true)}" end |
#load_config ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/jruby_art/config.rb', line 20 def load_config config_path = File.join(File.join(HOME, '.jruby_art', 'config.yml')) if File.exist? config_path loaded = YAML.safe_load(File.read(config_path)) @config = Default.config.merge(loaded) return self unless loaded.key? 'PROCESSING_ROOT' warn '*********** Move Old Config File ***************' end @config = Default.config warn '*********** Default Config Loaded ***************' self end |