Class: Neutral::VotingBuilder::Structure

Inherits:
Object
  • Object
show all
Defined in:
lib/neutral/voting_builder/structure.rb

Instance Method Summary collapse

Constructor Details

#initialize(persisted, difference) ⇒ Structure

Returns a new instance of Structure.



4
5
6
7
# File 'lib/neutral/voting_builder/structure.rb', line 4

def initialize(persisted, difference)
  @persisted = persisted
  @difference = difference
end

Instance Method Details

#to_aObject



9
10
11
12
13
# File 'lib/neutral/voting_builder/structure.rb', line 9

def to_a
  structure = %w[positive_span positive_link difference_span negative_link negative_span remove_link]
  structure -= %w[remove_link] unless can_change?
  structure -= @difference ? %w[positive_span negative_span] : %w[difference_span]
end