Sha256: 9eb61036b4521b7312444c75859cedd423162f1c7afcc3d8391936a34b7a1b71

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

require_relative 'builder/html_options'

module SeemsRateable
  class Builder
    include ActionView::Helpers::TagHelper

    attr_reader :rateable, :options

    def self.build(rateable, options)
      new(rateable, options).build
    end

    def initialize(rateable, options)
      @rateable, @options = rateable, options
    end

    def build
      content_tag :div, nil, html_options
    end

    private

    def html_options
      HtmlOptions.new(rating, options).to_h
    end

    def rating
      rateable.rating dimension
    end

    def dimension
      options.delete(:dimension)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seems_rateable-2.0.0 lib/seems_rateable/builder.rb