Sha256: cfff7dc72e781d75b5e6f6a601277e3b84d5765c219572460c0620c69f2e8e5e
Contents?: true
Size: 820 Bytes
Versions: 8
Compression:
Stored size: 820 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, class: 'positive' end end class Negative < Span def to_s content_tag :span, total, class: 'negative' end end class Difference < Span def to_s content_tag :span, total.try(:abs), class: "difference #{color}" end private def color total > 0 ? 'positive' : 'negative' if total end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems