Sha256: f6b18ab14c2163ec89156cf8cd7f078bf0984ba01e5fc632ab639996ac4e648f
Contents?: true
Size: 1.56 KB
Versions: 9
Compression:
Stored size: 1.56 KB
Contents
# frozen_string_literal: true module Playbook module PbStatValue class StatValue < Playbook::PbKit::Base PROPS = %i[configured_classname configured_data configured_id configured_unit configured_value].freeze def initialize(classname: default_configuration, data: default_configuration, id: default_configuration, unit: default_configuration, value: default_configuration) self.configured_classname = classname self.configured_data = data self.configured_id = id self.configured_unit = unit self.configured_value = value end def value default_value(configured_value, 0) end def display_value pb_title = Playbook::PbTitle::Title.new(size: 1, text: value) ApplicationController.renderer.render(partial: pb_title, as: :object) end def unit default_value(configured_unit, nil) end def display_unit unless unit.nil? pb_unit = Playbook::PbTitle::Title.new(size: 3, text: unit) ApplicationController.renderer.render(partial: pb_unit, as: :object) end end def kit_class "pb_stat_value_kit" end def to_partial_path "pb_stat_value/stat_value" end private DEFAULT = Object.new private_constant :DEFAULT def default_configuration DEFAULT end attr_accessor(*PROPS) end end end
Version data entries
9 entries across 9 versions & 1 rubygems