Sha256: d2b2fc341673bf619ad173638a0e4308a6e45b1314daf3cff56c545f8dbba9d3
Contents?: true
Size: 704 Bytes
Versions: 2
Compression:
Stored size: 704 Bytes
Contents
require 'aldous/simple_dto' module Aldous module Respondable class Base attr_reader :view_data, :view_context def initialize(status, view_data, view_context) @status = status @view_data = view_data @view_context = view_context end def action(controller) raise Errors::UserError.new("Respondables must define an 'action' method") end def status @status || default_status end def default_status :ok end def build_view(klass, extra_data = {}) dto = Aldous::SimpleDto.new(view_data._data.merge(extra_data)) klass.new(status, dto, view_context) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aldous-1.0.1 | lib/aldous/respondable/base.rb |
aldous-1.0.0 | lib/aldous/respondable/base.rb |