Sha256: ef05542ac1180c7713a6f32f87df027de809117713a887f240df95a216e6b846

Contents?: true

Size: 1.73 KB

Versions: 5

Compression:

Stored size: 1.73 KB

Contents

module Playbook
  module PbBody
    class Body < Playbook::PbKit::Base
      PROPS = [:configured_classname,
          :configured_color,
          :configured_dark,
          :configured_data,
          :configured_id,
          :configured_tag,
          :configured_text].freeze

      def initialize(classname: default_configuration,
                   color: default_configuration,
                   dark: default_configuration,
                   data: default_configuration,
                   id: default_configuration,
                   tag: default_configuration,
                   text: default_configuration)
        self.configured_classname = classname
        self.configured_color = color
        self.configured_dark = dark
        self.configured_data = data
        self.configured_id = id
        self.configured_tag = tag
        self.configured_text = text
      end

      def color
        if configured_color == default_configuration
          ""
        else
          "_#{configured_color}"
        end
      end

      def dark
        if configured_dark == default_configuration
          ""
        else
          if (configured_dark == true)
            "_dark"
          end
        end
      end

      def tag
        if configured_tag == default_configuration
          "p"
        else
          configured_tag
        end
      end

      def text
        if configured_text == default_configuration
          "This is some text"
        else
          configured_text
        end
      end

      def to_partial_path
        "pb_body/body"
      end

    private

      DEFAULT = Object.new
      private_constant :DEFAULT
      def default_configuration
        DEFAULT
      end
      attr_accessor(*PROPS)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
playbook_ui-2.7.2 app/pb_kits/playbook/pb_body/body.rb
playbook_ui-2.7.1 app/pb_kits/playbook/pb_body/body.rb
playbook_ui-2.7.0 app/pb_kits/playbook/pb_body/body.rb
playbook_ui-2.6.0 app/pb_kits/playbook/pb_body/body.rb
playbook_ui-2.5.0 app/pb_kits/playbook/pb_body/body.rb