Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

tropperstyle/simple_presenter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimplePresenter

A simple presentation pattern in ruby.

Overview

Many presentation patterns in ruby seemed to over complicate things. This is a very simple solution, intended to "decorate" your model methods with a presentaion layer

Usage

Quick example:

class Simple
  module Present
    def time
      super.strftime('%B %d, %Y')
    end
  end

  include SimplePresenter
  define_presentation :with => Present

  def time
    Time.now
  end
end

Output:

>> test = Simple.new
=> #<Simple:0x10164b368>
>> test.time
=> Mon Nov 29 15:02:01 -0800 2010
>> test.present(:time)
=> "November 29, 2010"

About

A Simple Ruby Presentation Pattern

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages