Class: VoteFu::Configuration
- Inherits:
-
Object
- Object
- VoteFu::Configuration
- Defined in:
- lib/vote_fu/configuration.rb
Instance Attribute Summary collapse
-
#action_cable ⇒ Object
Use ActionCable for real-time updates?.
-
#allow_duplicate_votes ⇒ Object
Can voters cast multiple votes on the same item?.
-
#allow_recast ⇒ Object
Can voters change their vote after casting?.
-
#allow_self_vote ⇒ Object
Can a model vote on itself?.
-
#counter_cache ⇒ Object
Automatically maintain counter cache columns?.
-
#default_ranking ⇒ Object
Default ranking algorithm (:wilson_score, :reddit_hot, :hacker_news, :simple).
-
#hot_ranking_gravity ⇒ Object
Gravity parameter for hot ranking algorithms.
-
#turbo_broadcasts ⇒ Object
Broadcast vote changes via Turbo Streams?.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Configuration
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vote_fu/configuration.rb', line 29 def initialize @allow_recast = true @allow_duplicate_votes = false @allow_self_vote = false @counter_cache = true @turbo_broadcasts = true @action_cable = true @default_ranking = :wilson_score @hot_ranking_gravity = 1.8 end |
Instance Attribute Details
#action_cable ⇒ Object
Use ActionCable for real-time updates?
21 22 23 |
# File 'lib/vote_fu/configuration.rb', line 21 def action_cable @action_cable end |
#allow_duplicate_votes ⇒ Object
Can voters cast multiple votes on the same item?
9 10 11 |
# File 'lib/vote_fu/configuration.rb', line 9 def allow_duplicate_votes @allow_duplicate_votes end |
#allow_recast ⇒ Object
Can voters change their vote after casting?
6 7 8 |
# File 'lib/vote_fu/configuration.rb', line 6 def allow_recast @allow_recast end |
#allow_self_vote ⇒ Object
Can a model vote on itself?
12 13 14 |
# File 'lib/vote_fu/configuration.rb', line 12 def allow_self_vote @allow_self_vote end |
#counter_cache ⇒ Object
Automatically maintain counter cache columns?
15 16 17 |
# File 'lib/vote_fu/configuration.rb', line 15 def counter_cache @counter_cache end |
#default_ranking ⇒ Object
Default ranking algorithm (:wilson_score, :reddit_hot, :hacker_news, :simple)
24 25 26 |
# File 'lib/vote_fu/configuration.rb', line 24 def default_ranking @default_ranking end |
#hot_ranking_gravity ⇒ Object
Gravity parameter for hot ranking algorithms
27 28 29 |
# File 'lib/vote_fu/configuration.rb', line 27 def hot_ranking_gravity @hot_ranking_gravity end |
#turbo_broadcasts ⇒ Object
Broadcast vote changes via Turbo Streams?
18 19 20 |
# File 'lib/vote_fu/configuration.rb', line 18 def turbo_broadcasts @turbo_broadcasts end |
Instance Method Details
#to_h ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vote_fu/configuration.rb', line 40 def to_h { allow_recast: allow_recast, allow_duplicate_votes: allow_duplicate_votes, allow_self_vote: allow_self_vote, counter_cache: counter_cache, turbo_broadcasts: turbo_broadcasts, action_cable: action_cable, default_ranking: default_ranking, hot_ranking_gravity: hot_ranking_gravity } end |