# 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 # https://github.com/heartcombo/devise/blob/b52e642c0131f7b0d9f2dd24d8607a186f18223e/lib/devise.rb#L301 # Gem::Version.new('0.4.1') > Gem::Version.new('0.10.1') # Здесь вроде также используют https://github.com/rspec/rspec-rails/blob/9b7ab39c027a8cb25e2ebe9e0e985756025b0549/Gemfile#L45 # https://github.com/JuanitoFatas/fast-ruby/blob/38f49f95fc7574d929de60b71791d09129c2588c/code/string/%3D%3D%3D-vs-%3D~-vs-match.rb#L20 @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