From 4e034f42107a2016db3a032d3c0cd1a5f8e43635 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 23 Jan 2018 14:45:47 +0100 Subject: AF83::Decorator::Link: Change #class? to #default_class Instead of checking for an existing class and then setting the class, provide a method to set a default class when one hasn't been defined. This does effectively the same thing but moves the condition inside the method. Thanks Johan for the suggestion! Refs #5586 --- lib/af83/decorator/link.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/af83/decorator/link.rb b/lib/af83/decorator/link.rb index 10e6091aa..fd50069fe 100644 --- a/lib/af83/decorator/link.rb +++ b/lib/af83/decorator/link.rb @@ -25,8 +25,11 @@ class AF83::Decorator::Link link_class args end - def class? - @options[:link_class] && !@options[:link_class].empty? + def default_class *args + has_class = @options[:link_class] && !@options[:link_class].empty? + return if has_class + + self.class args end def method_missing name, *args, &block -- cgit v1.2.3