Sha256: ade8b9425aaaec26a7cb03ff4a81316653b74cf3167d53e9bace59c47c61166b
Contents?: true
Size: 694 Bytes
Versions: 5
Compression:
Stored size: 694 Bytes
Contents
class Reporter::Value def initialize(field_alias, field_human_name, value, human_value, description, source_link) @field_alias = field_alias @field_human_name = field_human_name || field_alias @value = value @human_value = human_value @description = description @source_link = source_link end attr_reader :field_alias, :field_human_name attr_accessor :value, :description, :source_link attr_writer :human_value def human_value @human_value || value end def to_s human_value end def as_percentage if @value.is_a? Numeric "%.2f %%" % (@value * 100.0) end end def round(precision = 2) if @value.is_a? Numeric "%.#{precision}f" % @value end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
reporter-0.0.5 | lib/reporter/value.rb |
reporter-0.0.4 | lib/reporter/value.rb |
reporter-0.0.3 | lib/reporter/value.rb |
reporter-0.0.2 | lib/reporter/value.rb |
reporter-0.0.1 | lib/reporter/value.rb |