Sha256: 0d8bc5bb9352ff2211ecedc46354b9e9c168d1b14a5ace75fe8b2533853ad62e

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

# An BasePresenter for ResponseCodes
class Lurker::ResponseCodePresenter < Lurker::BasePresenter
  attr_reader :response_code

  def initialize(response_code, options)
    super(options)
    @response_code = response_code
  end

  def to_html
    <<-EOS
      <div class="response-code">
        <span class="status">
          #{status}
        </span>
        #{description}
      </div>
    EOS
  end

  def to_markdown
    "__#{status}__: #{description_raw}"
  end

  def successful?
    response_code["successful"]
  end

  def status
    response_code["status"]
  end

  def description
    render_markdown(description_raw)
  end

  def description_raw
    response_code["description"]
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lurker-0.5.3 lib/lurker/presenters/response_code_presenter.rb
lurker-0.5.2 lib/lurker/presenters/response_code_presenter.rb
lurker-0.5.1 lib/lurker/presenters/response_code_presenter.rb
lurker-0.5.0 lib/lurker/presenters/response_code_presenter.rb