From f35573f12eb579b31b014fa99509c694021c33c7 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Wed, 19 Apr 2017 19:14:40 -0300 Subject: [PATCH] Extract common attributes to Github::Representation::Base --- lib/github/representation/base.rb | 12 ++++++++++++ lib/github/representation/comment.rb | 12 ------------ lib/github/representation/issue.rb | 12 ------------ lib/github/representation/label.rb | 4 ---- lib/github/representation/milestone.rb | 12 ------------ lib/github/representation/pull_request.rb | 12 ------------ 6 files changed, 12 insertions(+), 52 deletions(-) diff --git a/lib/github/representation/base.rb b/lib/github/representation/base.rb index 6765bfb803b..5ea294ed49c 100644 --- a/lib/github/representation/base.rb +++ b/lib/github/representation/base.rb @@ -5,6 +5,18 @@ module Github @raw = raw end + def url + raw['url'] + end + + def created_at + raw['created_at'] + end + + def updated_at + raw['updated_at'] + end + private attr_reader :raw diff --git a/lib/github/representation/comment.rb b/lib/github/representation/comment.rb index 819e4107118..02bcd9eaa0e 100644 --- a/lib/github/representation/comment.rb +++ b/lib/github/representation/comment.rb @@ -24,18 +24,6 @@ module Github 'LegacyDiffNote' if on_diff? end - def url - raw['url'] - end - - def created_at - raw['created_at'] - end - - def updated_at - raw['updated_at'] - end - private def generate_line_code(line) diff --git a/lib/github/representation/issue.rb b/lib/github/representation/issue.rb index f155880b984..3bb767a5daa 100644 --- a/lib/github/representation/issue.rb +++ b/lib/github/representation/issue.rb @@ -37,18 +37,6 @@ module Github raw['state'] == 'closed' ? 'closed' : 'opened' end - def url - raw['url'] - end - - def created_at - raw['created_at'] - end - - def updated_at - raw['updated_at'] - end - def assigned? raw['assignee'].present? end diff --git a/lib/github/representation/label.rb b/lib/github/representation/label.rb index b3140ab76fc..60aa51f9569 100644 --- a/lib/github/representation/label.rb +++ b/lib/github/representation/label.rb @@ -8,10 +8,6 @@ module Github def title raw['name'] end - - def url - raw['url'] - end end end end diff --git a/lib/github/representation/milestone.rb b/lib/github/representation/milestone.rb index 5ea54eb178f..917e6394ad4 100644 --- a/lib/github/representation/milestone.rb +++ b/lib/github/representation/milestone.rb @@ -20,18 +20,6 @@ module Github def state raw['state'] == 'closed' ? 'closed' : 'active' end - - def url - raw['url'] - end - - def created_at - raw['created_at'] - end - - def updated_at - raw['updated_at'] - end end end end diff --git a/lib/github/representation/pull_request.rb b/lib/github/representation/pull_request.rb index 85f4e1bdac3..b33561565bf 100644 --- a/lib/github/representation/pull_request.rb +++ b/lib/github/representation/pull_request.rb @@ -71,18 +71,6 @@ module Github 'opened' end - def url - raw['url'] - end - - def created_at - raw['created_at'] - end - - def updated_at - raw['updated_at'] - end - def assigned? raw['assignee'].present? end -- GitLab