class Fdbq::Plugin
Constants
- DEFAULT_PARAM_KEY
Attributes
config_file_path[RW]
controller_extensions[RW]
model_extensions[RW]
param_key[RW]
Public Instance Methods
build_param_key(question_name)
click to toggle source
# File lib/fdbq/plugin.rb, line 40 def build_param_key(question_name) "#{param_key}[#{question_name}]" end
config()
click to toggle source
# File lib/fdbq/plugin.rb, line 36 def config YAML.load_file(config_file_path).to_h end
questions()
click to toggle source
# File lib/fdbq/plugin.rb, line 24 def questions config.dig('questions').to_a.map(&Question.method(:new)) end
reset!()
click to toggle source
# File lib/fdbq/plugin.rb, line 19 def reset! self.param_key = DEFAULT_PARAM_KEY self.config_file_path = nil end
settings()
click to toggle source
# File lib/fdbq/plugin.rb, line 28 def settings config.tap do |c| c['questions']&.map! { |el| el.merge('name' => build_param_key(el['name'])) } c['submit'] = { url: Rails::Engine.routes.url_helpers.feedback_path } end end