Sha256: 66bf66bd5082a2df759aecc7080753c7d1f16594fcc36a3a86047d749b082455
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
module BootstrapNavbar::Helpers def self.included(base) if BootstrapNavbar.configuration.bootstrap_version.nil? if Gem.loaded_specs.keys.include?('bootstrap-sass') bootstrap_sass_version = Gem.loaded_specs['bootstrap-sass'].version bootstrap_version = bootstrap_sass_version.segments.take(3).join('.') BootstrapNavbar.configuration.bootstrap_version = bootstrap_version else raise 'Bootstrap version is not configured.' end end helper_version = BootstrapNavbar.configuration.bootstrap_version[0] base.send :include, const_get("Bootstrap#{helper_version}") end def attributes_for_tag(hash) string = hash.map { |k, v| %(#{k}="#{v}") }.join(' ') if string.length > 0 ' ' << string else string end end def current_url?(url) normalized_path, normalized_current_path = [url, current_url].map do |url| URI.parse(url).path.sub(%r(/\z), '') rescue nil end normalized_path == normalized_current_path end def current_url raise StandardError, 'current_url_method is not defined.' if BootstrapNavbar.configuration.current_url_method.nil? eval BootstrapNavbar.configuration.current_url_method end def prepare_html(html) html end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bootstrap-navbar-2.0.0 | lib/bootstrap-navbar/helpers.rb |
bootstrap-navbar-1.1.0 | lib/bootstrap-navbar/helpers.rb |
bootstrap-navbar-1.0.2 | lib/bootstrap-navbar/helpers.rb |