Sha256: 7cb3e5eba1913a3af88ef5def2b97b6355da267745d64633580cbd381bb52dd7

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require 'singleton'
require 'rails'

module Bemer
  class Configuration
    include Singleton

    attr_accessor :bem, :default_block_tag, :default_element_tag, :default_path_prefix,
                  :element_name_separator, :modifier_name_separator, :modifier_value_separator,
                  :prepend_asset_paths, :paths, :asset_paths
    attr_reader   :can_use_new_matcher
    attr_writer   :path

    alias can_use_new_matcher? can_use_new_matcher

    def initialize # rubocop:disable Metrics/MethodLength
      @asset_paths              = []
      @bem                      = false
      # Gem::Version.new('0.4.1') > Gem::Version.new('0.10.1')
      @can_use_new_matcher      = RUBY_VERSION >= '2.4.0'
      @default_block_tag        = :div
      @default_element_tag      = :div
      @default_path_prefix      = nil
      @element_name_separator   = '__'
      @modifier_name_separator  = '_'
      @modifier_value_separator = '_'
      @path                     = 'app/bemer_components'
      @paths                    = []
      @prepend_asset_paths      = true
    end

    def path
      Rails.root ? Rails.root.join(@path) : @path
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bemer-0.2.0 lib/bemer/configuration.rb