class ThumbsUp::Configuration
Constants
- OPTIONS
Attributes
voteable_relationship_name[RW]
Specify the name of the relationship from voted on things to voters. Default is votes In order to have a model that votes on itself,
e.g. Users vote on Users, must change :voteable_relationship_name or :voter_relationship_name to a non-default value
voter_relationship_name[RW]
Specify the name of the relationship from voters to voted on things Default is votes In order to have a model that votes on itself,
e.g. Users vote on Users, must change :voteable_relationship_name or :voter_relationship_name to a non-default value
Public Class Methods
new()
click to toggle source
# File lib/thumbs_up/configuration.rb, line 22 def initialize # these defaults can be overridden in the ThumbsUp.config block @voteable_relationship_name = :votes @voter_relationship_name = :votes end
Public Instance Methods
[](option)
click to toggle source
Allows config options to be read like a hash
@param [Symbol] option Key for a given attribute
# File lib/thumbs_up/configuration.rb, line 31 def [](option) send(option) end
merge(hash)
click to toggle source
Returns a hash of all configurable options merged with hash
@param [Hash] hash A set of configuration options that will take precedence over the defaults
# File lib/thumbs_up/configuration.rb, line 46 def merge(hash) to_hash.merge(hash) end
to_hash()
click to toggle source
Returns a hash of all configurable options
# File lib/thumbs_up/configuration.rb, line 36 def to_hash OPTIONS.inject({}) do |hash, option| hash[option.to_sym] = self.send(option) hash end end