Skip to content

Commit

Permalink
Merge pull request #175 from tagliala/chore/minor-improvements
Browse files Browse the repository at this point in the history
Minor improvements
  • Loading branch information
jamesmartin authored Nov 29, 2024
2 parents 8c74576 + 5a7078c commit 0646994
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 31 deletions.
18 changes: 0 additions & 18 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/inline_svg/action_view/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def with_asset_finder(asset_finder)
end

def extension_hint(filename)
filename.ends_with?(".svg") ? "" : "(Try adding .svg to your filename) "
filename.end_with?(".svg") ? "" : "(Try adding .svg to your filename) "
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/inline_svg/transform_pipeline/transformations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def self.lookup(transform_params)
return [] unless transform_params.any? || custom_transformations.any?

transform_params_with_defaults = params_with_defaults(transform_params)
all_transformations.map { |name, definition|
all_transformations.filter_map do |name, definition|
value = transform_params_with_defaults[name]
definition.fetch(:transform, no_transform).create_with_value(value) if value
}.compact
end
end

def self.in_priority_order(transforms)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module InlineSvg::TransformPipeline::Transformations
class AriaHidden < Transformation
def transform(doc)
with_svg(doc) do |svg|
svg["aria-hidden"] = self.value
svg["aria-hidden"] = value
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module InlineSvg::TransformPipeline::Transformations
class AriaHiddenAttribute < Transformation
def transform(doc)
with_svg(doc) do |svg|
svg["aria-hidden"] = self.value
svg["aria-hidden"] = value
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module InlineSvg::TransformPipeline::Transformations
class DataAttributes < Transformation
def transform(doc)
with_svg(doc) do |svg|
with_valid_hash_from(self.value).each_pair do |name, data|
with_valid_hash_from(value).each_pair do |name, data|
svg["data-#{dasherize(name)}"] = data
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module InlineSvg::TransformPipeline::Transformations
class Height < Transformation
def transform(doc)
with_svg(doc) do |svg|
svg["height"] = self.value
svg["height"] = value
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module InlineSvg::TransformPipeline::Transformations
class IdAttribute < Transformation
def transform(doc)
with_svg(doc) do |svg|
svg["id"] = self.value
svg["id"] = value
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module InlineSvg::TransformPipeline::Transformations
class PreserveAspectRatio < Transformation
def transform(doc)
with_svg(doc) do |svg|
svg["preserveAspectRatio"] = self.value
svg["preserveAspectRatio"] = value
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/inline_svg/transform_pipeline/transformations/size.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module InlineSvg::TransformPipeline::Transformations
class Size < Transformation
def transform(doc)
with_svg(doc) do |svg|
svg["width"] = width_of(self.value)
svg["height"] = height_of(self.value)
svg["width"] = width_of(value)
svg["height"] = height_of(value)
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module InlineSvg::TransformPipeline::Transformations
class Transformation
def self.create_with_value(value)
self.new(value)
new(value)
end

attr_reader :value
Expand Down
2 changes: 1 addition & 1 deletion lib/inline_svg/transform_pipeline/transformations/width.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module InlineSvg::TransformPipeline::Transformations
class Width < Transformation
def transform(doc)
with_svg(doc) do |svg|
svg["width"] = self.value
svg["width"] = value
end
end
end
Expand Down

0 comments on commit 0646994

Please sign in to comment.