lib/hanami/helpers/assets_helper.rb in hanami-2.1.0.beta2.1 vs lib/hanami/helpers/assets_helper.rb in hanami-2.1.0.rc1

- old
+ new

@@ -152,11 +152,11 @@ # # <%= js "application" %> # # # <script src="https://assets.bookshelf.org/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js" # # type="text/javascript"></script> - def javascript(*source_paths, **options) + def javascript_tag(*source_paths, **options) options = options.reject { |k, _| k.to_sym == :src } _safe_tags(*source_paths) do |source| attributes = { src: _typed_path(source, JAVASCRIPT_EXT), @@ -171,18 +171,10 @@ tag.script(**attributes).to_s end end - # @api public - # @since 2.1.0 - alias_method :js, :javascript - - # @api public - # @since 2.1.0 - alias_method :javascript_tag, :javascript - # Generate `link` tag for given source(s) # # It accepts one or more strings representing the name of the asset, if it # comes from the application or third party gems. It also accepts strings # representing absolute URLs in case of public CDN (eg. Bootstrap CDN). @@ -253,11 +245,11 @@ # # <%= css "application" %> # # # <link href="https://assets.bookshelf.org/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.css" # # type="text/css" rel="stylesheet"> - def stylesheet(*source_paths, **options) + def stylesheet_tag(*source_paths, **options) options = options.reject { |k, _| k.to_sym == :href } _safe_tags(*source_paths) do |source_path| attributes = { href: _typed_path(source_path, STYLESHEET_EXT), @@ -273,18 +265,10 @@ tag.link(**attributes).to_s end end - # @api public - # @since 2.1.0 - alias_method :css, :stylesheet - - # @api public - # @since 2.1.0 - alias_method :stylesheet_link_tag, :stylesheet - # Generate `img` tag for given source # # It accepts one string representing the name of the asset, if it comes # from the application or third party gems. It also accepts string # representing absolute URLs in case of public CDN (eg. Bootstrap CDN). @@ -344,25 +328,21 @@ # @example CDN Mode # # <%= image "logo.png" %> # # # <img src="https://assets.bookshelf.org/assets/logo-28a6b886de2372ee3922fcaf3f78f2d8.png" alt="Logo"> - def image(source, options = {}) + def image_tag(source, options = {}) options = options.reject { |k, _| k.to_sym == :src } attributes = { src: asset_url(source), alt: _context.inflector.humanize(::File.basename(source, WILDCARD_EXT)) } attributes.merge!(options) tag.img(**attributes) end - # @api public - # @since 2.1.0 - alias_method :image_tag, :image - # Generate `link` tag application favicon. # # If no argument is given, it assumes `favico.ico` from the application. # # It accepts one string representing the name of the asset. @@ -414,11 +394,11 @@ # # <%= favicon %> # # # <link href="https://assets.bookshelf.org/assets/favicon-28a6b886de2372ee3922fcaf3f78f2d8.ico" # rel="shortcut icon" type="image/x-icon"> - def favicon(source = DEFAULT_FAVICON, options = {}) + def favicon_tag(source = DEFAULT_FAVICON, options = {}) options = options.reject { |k, _| k.to_sym == :href } attributes = { href: asset_url(source), rel: FAVICON_REL, @@ -427,14 +407,10 @@ attributes.merge!(options) tag.link(**attributes) end - # @api public - # @since 2.1.0 - alias_method :favicon_link_tag, :favicon - # Generate `video` tag for given source # # It accepts one string representing the name of the asset, if it comes # from the application or third party gems. It also accepts string # representing absolute URLs in case of public CDN (eg. Bootstrap CDN). @@ -528,19 +504,15 @@ # @example CDN Mode # # <%= video "movie.mp4" %> # # # <video src="https://assets.bookshelf.org/assets/movie-28a6b886de2372ee3922fcaf3f78f2d8.mp4"></video> - def video(source = nil, options = {}, &blk) + def video_tag(source = nil, options = {}, &blk) options = _source_options(source, options, &blk) tag.video(**options, &blk) end - # @api public - # @since 2.1.0 - alias_method :video_tag, :video - # Generate `audio` tag for given source # # It accepts one string representing the name of the asset, if it comes # from the application or third party gems. It also accepts string # representing absolute URLs in case of public CDN (eg. Bootstrap CDN). @@ -634,17 +606,13 @@ # @example CDN Mode # # <%= audio "song.ogg" %> # # # <audio src="https://assets.bookshelf.org/assets/song-28a6b886de2372ee3922fcaf3f78f2d8.ogg"></audio> - def audio(source = nil, options = {}, &blk) + def audio_tag(source = nil, options = {}, &blk) options = _source_options(source, options, &blk) tag.audio(**options, &blk) end - - # @api public - # @since 2.1.0 - alias_method :audio_tag, :audio # It generates the relative or absolute URL for the given asset. # It automatically decides if it has to use the relative or absolute # depending on the configuration and current environment. #