Sha256: 1f55229c042ce89b35bcc2fae91d3d46c9b2c1affce77228dd3e1e3301134183

Contents?: true

Size: 502 Bytes

Versions: 4

Compression:

Stored size: 502 Bytes

Contents

require 'action_view'
require 'rinku'

module Stratify
  module GitHub
    class Presenter
      include ActionView::Helpers::UrlHelper

      def initialize(activity)
        @activity = activity
      end

      def text
        clazz = Stratify::GitHub::Event.const_get(@activity.event_type)
        return clazz.text(@activity)
      end

      def to_html
        linkify_urls(text)
      end

      private

      def linkify_urls(text)
        Rinku.auto_link(text)
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stratify-github-0.1.3 lib/stratify-github/presenter.rb
stratify-github-0.1.2 lib/stratify-github/presenter.rb
stratify-github-0.1.1 lib/stratify-github/presenter.rb
stratify-github-0.1 lib/stratify-github/presenter.rb