From ce70c06397afe88d239a1fa973b0ba2fa5d498de Mon Sep 17 00:00:00 2001 From: John Wilkinson Date: Thu, 9 Jun 2016 16:01:22 +0800 Subject: [PATCH] Delegate to Roar's represent w/o options argument Small change that seems to grant us all of the niceties of Roar's represent for free --- lib/grape/roar/decorator.rb | 2 +- lib/grape/roar/representer.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/grape/roar/decorator.rb b/lib/grape/roar/decorator.rb index 923f103..84eda70 100644 --- a/lib/grape/roar/decorator.rb +++ b/lib/grape/roar/decorator.rb @@ -4,7 +4,7 @@ module Grape module Roar class Decorator < ::Roar::Decorator def self.represent(object, _options = {}) - new(object) + super(object) end end end diff --git a/lib/grape/roar/representer.rb b/lib/grape/roar/representer.rb index e24678a..44c905e 100644 --- a/lib/grape/roar/representer.rb +++ b/lib/grape/roar/representer.rb @@ -2,13 +2,14 @@ module Grape module Roar module Representer def self.included(base) + super + base.send(:include, ::Roar::Representer) base.extend(ClassMethods) end module ClassMethods def represent(object, _options = {}) - object.extend self - object + super(object) end end end