The code below runs as intended however are they any disadvantages to override a method (see action_label in the code below) with the getter of an attribute? See the :action_label in the code
class BaseAction
def action_label
raise NotImplementedError
end
def run
puts "Running action: #{action_label}"
yield
end
end
class SimpleAction < BaseAction
def initialize(label)
@action_label = label
end
private
attr_reader :action_label
end
sa = SimpleAction.new("foo")
sa.run {puts "action!"}