Skip to content

Commit

Permalink
Fix: rubocop failures
Browse files Browse the repository at this point in the history
  • Loading branch information
kernow committed May 1, 2019
1 parent ae59ba5 commit 611d95a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
6 changes: 0 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ Style/SafeNavigation:

Style/NumericPredicate:
Enabled: false

Performance/RegexpMatch:
Enabled: false
# END Ruby 2.4 editions

Layout/SpaceAroundEqualsInParameterDefault:
Expand All @@ -56,9 +53,6 @@ Style/Lambda:
Style/ClassAndModuleChildren:
Enabled: false

Performance/Casecmp:
Enabled: false

Style/Alias:
Enabled: false

Expand Down
2 changes: 2 additions & 0 deletions lib/shortcode/presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def self.validate(presenter)
unless presenter.private_instance_methods(false).include?(:initialize)
raise ArgumentError, "The presenter must define an initialize method"
end

%w[content attributes].each do |method|
unless presenter.method_defined?(method.to_sym)
raise ArgumentError, "The presenter must define the method ##{method}"
Expand All @@ -35,6 +36,7 @@ def initialize(name, configuration, attributes, content, additional_attributes)

def initialize_custom_presenter(name)
return unless configuration.presenters.key?(name.to_sym)

presenter = configuration.presenters[name.to_sym].new(@attributes, @content, @additional_attributes)
@attributes = presenter.attributes
@content = presenter.content
Expand Down
1 change: 1 addition & 0 deletions lib/shortcode/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def markup
template = first_priority_template
template = second_priority_template if template.nil?
return template unless template.nil?

raise Shortcode::TemplateNotFound, "No template found for #{@name} in configuration or files"
end

Expand Down
10 changes: 5 additions & 5 deletions lib/shortcode/transformer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ def setup_rules

klass.rule(text: klass.send(:simple, :text)) { String(text) }
klass.rule(
open: klass.send(:simple, :name),
options: klass.send(:subtree, :options),
inner: klass.send(:sequence, :inner),
close: klass.send(:simple, :name)
open: klass.send(:simple, :name),
options: klass.send(:subtree, :options),
inner: klass.send(:sequence, :inner),
close: klass.send(:simple, :name)
) { Shortcode::Tag.new(name.to_s, config, options, inner.join, additional_attributes).render }
klass.rule(
open_close: klass.send(:simple, :name),
options: klass.send(:subtree, :options)
options: klass.send(:subtree, :options)
) { Shortcode::Tag.new(name.to_s, config, options, "", additional_attributes).render }

klass.rule(body: klass.send(:sequence, :strings)) { strings.join }
Expand Down
3 changes: 1 addition & 2 deletions shortcode.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "shortcode/version"

Expand Down

0 comments on commit 611d95a

Please sign in to comment.