Class: BallotBox::Strategies::Base

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/ballot_box/strategies/base.rb

Direct Known Subclasses

Authenticated

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(voteable, vote) ⇒ Base

Returns a new instance of Base.



10
11
12
13
14
# File 'lib/ballot_box/strategies/base.rb', line 10

def initialize(voteable, vote)
  @voteable = voteable
  @vote = vote
  @request = vote.request
end

Instance Attribute Details

#requestObject

Returns the value of attribute request.



8
9
10
# File 'lib/ballot_box/strategies/base.rb', line 8

def request
  @request
end

#voteObject

Returns the value of attribute vote.



8
9
10
# File 'lib/ballot_box/strategies/base.rb', line 8

def vote
  @vote
end

#voteableObject

Returns the value of attribute voteable.



8
9
10
# File 'lib/ballot_box/strategies/base.rb', line 8

def voteable
  @voteable
end

Instance Method Details

#errorsObject

Returns the Errors object that holds all information about attribute error messages.



21
22
23
# File 'lib/ballot_box/strategies/base.rb', line 21

def errors
  @vote.errors
end

#read_attribute_for_validation(key) ⇒ Object



16
17
18
# File 'lib/ballot_box/strategies/base.rb', line 16

def read_attribute_for_validation(key)
  @vote[key]
end