Module: X::Editable::Rails::Configuration
- Extended by:
- Configuration
- Included in:
- Configuration
- Defined in:
- lib/x-editable-rails/configuration.rb
Instance Method Summary collapse
- #class_options ⇒ Object
- #class_options_for(object) ⇒ Object
- #load_yaml_file(path) ⇒ Object
- #method_options_for(object, method) ⇒ Object
- #options ⇒ Object
Instance Method Details
#class_options ⇒ Object
15 16 17 |
# File 'lib/x-editable-rails/configuration.rb', line 15 def .fetch(:class_options, {}) end |
#class_options_for(object) ⇒ Object
10 11 12 13 |
# File 'lib/x-editable-rails/configuration.rb', line 10 def (object) = .fetch(:class_options, {}) .fetch(object.class.name, {}) end |
#load_yaml_file(path) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/x-editable-rails/configuration.rb', line 31 def load_yaml_file(path) source = File.read path source = ERB.new(source).result result = YAML.load(source) result = {} if result.blank? result.with_indifferent_access end |
#method_options_for(object, method) ⇒ Object
6 7 8 |
# File 'lib/x-editable-rails/configuration.rb', line 6 def (object, method) (object).fetch(method, {}) end |
#options ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/x-editable-rails/configuration.rb', line 19 def config_fn = ::Rails.root.join("config", "x-editable.yml") if File.file?(config_fn) @options ||= begin = load_yaml_file config_fn end else @options = {} end end |