Sha256: 7c403023b1e4ddc85152debf7303d7ee5a66ac95717067b66907e1c3ddde774a
Contents?: true
Size: 816 Bytes
Versions: 2
Compression:
Stored size: 816 Bytes
Contents
module Neutral module VotingBuilder module Elements class Span include ActionView::Helpers::TagHelper def initialize(total) @total = total end private def total @total.nonzero? end class Positive < Span def to_s content_tag :span, total, id: 'positive' end end class Negative < Span def to_s content_tag :span, total, id: 'negative' end end class Difference < Span def to_s content_tag :span, total.try(:abs), class: color, id: 'difference' end private def color total > 0 ? 'positive' : 'negative' if total end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
neutral-0.0.2 | lib/neutral/voting_builder/elements/span.rb |
neutral-0.0.1 | lib/neutral/voting_builder/elements/span.rb |