Sha256: 3315aa0aa3fa740603ff71488a8a2549331c9cbdf556caeef5dddfdb2d44273d

Contents?: true

Size: 564 Bytes

Versions: 42

Compression:

Stored size: 564 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbStarRating
    class StarRating
      include Playbook::Props

      partial "pb_star_rating/star_rating"

      prop :hide_rating, type: Playbook::Props::Boolean,
                         default: false
      prop :rating, type: Playbook::Props::Numeric,
                    default: 0

      def star_count
        [*1..rating.to_f]
      end

      def star_full
        (rating.to_f % 1).zero?
      end

      def classname
        generate_classname("pb_star_rating_kit")
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
playbook_ui-2.9.8 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-2.9.7 app/pb_kits/playbook/pb_star_rating/star_rating.rb