diff options
author | cmrd Senya <senya@riseup.net> | 2016-04-28 20:37:21 +0300 |
---|---|---|
committer | cmrd Senya <senya@riseup.net> | 2016-04-28 21:45:49 +0300 |
commit | ab718dbbc62613a16745d13f17860422a5c8db2b (patch) | |
tree | 92607eb7447a02fcf183eaef3b08052c645f60db /app/helpers | |
parent | 32fdec4493485566e60c5b3253eacb15e9c15d34 (diff) |
A minor refactor of the Publisher
There was a minor copy-paste issue with publisher_public and
publisher_explain methods. Fix it and do a little refactoring
of the publisher's code.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/interim_stream_hackiness_helper.rb | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/app/helpers/interim_stream_hackiness_helper.rb b/app/helpers/interim_stream_hackiness_helper.rb index 9ed9ad7a9..4219d29fe 100644 --- a/app/helpers/interim_stream_hackiness_helper.rb +++ b/app/helpers/interim_stream_hackiness_helper.rb @@ -39,27 +39,19 @@ module InterimStreamHackinessHelper end end + def publisher_method(method) + @stream.try(:publisher).try(method) == true + end + def publisher_open - if defined?(@stream) - @stream.publisher.open? - else - false - end + publisher_method(:open) end def publisher_public - if defined?(@stream) - @stream.publisher.public? - else - false - end + publisher_method(:public) end def publisher_explain - if defined?(@stream) - @stream.publisher.public? - else - false - end + publisher_method(:explain) end end |