module Rating::Config
Public Instance Methods
config()
click to toggle source
# File lib/rating/config.rb, line 7 def config @config ||= begin file_path = File.expand_path('config/rating.yml') return {} unless File.exist?(file_path) YAML.safe_load(File.read(file_path))['rating'] end end
rate_table()
click to toggle source
# File lib/rating/config.rb, line 17 def rate_table @rate_table ||= config[__method__.to_s] || 'rating_rates' end
rating_table()
click to toggle source
# File lib/rating/config.rb, line 21 def rating_table @rating_table ||= config[__method__.to_s] || 'rating_ratings' end
validations()
click to toggle source
# File lib/rating/config.rb, line 25 def validations @validations ||= begin default_scope = %w[author_type resource_id resource_type scopeable_id scopeable_type] { rate: { case_sensitive: config.dig('validations', 'rate', 'case_sensitive') || false, scope: config.dig('validations', 'rate', 'scope') || default_scope, }, }.deep_stringify_keys end end