Sha256: da09781f786793f357ae1f6544aea55dcc190e5663ed4333097370c02cc035c9

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

# An BasePresenter for ResponseCodes
class Fdoc::ResponseCodePresenter < Fdoc::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

3 entries across 3 versions & 1 rubygems

Version Path
fdoc-0.3.3 lib/fdoc/presenters/response_code_presenter.rb
fdoc-0.3.2 lib/fdoc/presenters/response_code_presenter.rb
fdoc-0.3.1 lib/fdoc/presenters/response_code_presenter.rb