Sha256: 1192871c03f6211ef70a694aa9aec7e08dbc21b8bbe143771736d88cc8455653
Contents?: true
Size: 915 Bytes
Versions: 5
Compression:
Stored size: 915 Bytes
Contents
# frozen_string_literal: true module Rating module Config module_function 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 def rate_table @rate_table ||= config[__method__.to_s] || 'rating_rates' end def rating_table @rating_table ||= config[__method__.to_s] || 'rating_ratings' end 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 end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rating-1.0.0 | lib/rating/config.rb |
rating-0.12.0 | lib/rating/config.rb |
rating-0.11.0 | lib/rating/config.rb |
rating-0.10.0 | lib/rating/config.rb |
rating-0.9.0 | lib/rating/config.rb |