Module: AjaxCanvasField
- Defined in:
- lib/ajax_canvas_field/rails.rb,
lib/ajax_canvas_field/config.rb,
lib/ajax_canvas_field/rails/engine.rb,
lib/ajax_canvas_field/rails/version.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Rails
Class Method Summary collapse
- .config ⇒ Object
-
.configure(opts = {}) ⇒ Object
Configure through hash.
-
.configure_with(path_to_yaml_file) ⇒ Object
Configure through yaml file.
Class Method Details
.config ⇒ Object
35 36 37 |
# File 'lib/ajax_canvas_field/config.rb', line 35 def self.config @config end |
.configure(opts = {}) ⇒ Object
Configure through hash
18 19 20 |
# File 'lib/ajax_canvas_field/config.rb', line 18 def self.configure(opts = {}) opts.each { |k, v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym } end |
.configure_with(path_to_yaml_file) ⇒ Object
Configure through yaml file
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ajax_canvas_field/config.rb', line 23 def self.configure_with(path_to_yaml_file) begin config = YAML.safe_load(IO.read(path_to_yaml_file)) rescue Errno::ENOENT log(:warning, "YAML configuration file couldn't be found. Using defaults."); return rescue Psych::SyntaxError log(:warning, 'YAML configuration file contains invalid syntax. Using defaults.'); return end configure(config) end |