Sha256: ff8ea5f30ed1cbbe5c098ef639d83d4dfd52191696b203d3f73ace97ec5af189

Contents?: true

Size: 759 Bytes

Versions: 200

Compression:

Stored size: 759 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbTitleCount
    class TitleCount
      include Playbook::Props

      partial "pb_title_count/title_count"

      prop :align, type: Playbook::Props::Enum,
                   values: %w[left center right],
                   default: "left"
      prop :size, type: Playbook::Props::Enum,
                  values: %w[lg sm],
                  default: "sm"
      prop :title
      prop :count, type: Playbook::Props::Numeric

      def classname
        generate_classname("pb_title_count_kit", align, size)
      end

      def title_size
        size == "lg" ? 3 : 4
      end

      def format_count
        count.to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/, '\1,\2')
      end
    end
  end
end

Version data entries

200 entries across 200 versions & 1 rubygems

Version Path
playbook_ui-4.5.1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.5.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.4.1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.4.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.3.1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.3.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.2.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.1.2 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.1.1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.1.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.0.1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.0.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-3.5.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-3.4.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-3.3.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-3.2.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-3.1.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-3.0.1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-3.0.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-2.9.9 app/pb_kits/playbook/pb_title_count/title_count.rb