Sha256: 39540583c50fec85f85e457f4d78028faf4c44dcfb435feb12da547770d9883e
Contents?: true
Size: 938 Bytes
Versions: 1
Compression:
Stored size: 938 Bytes
Contents
module Flutterby class View attr_reader :entity alias_method :page, :entity def initialize(entity) @entity = entity end def date_format(date, fmt) date.strftime(fmt) end def render(expr, *args) find(expr).render(*args) end def find(expr) entity.find(expr) or raise "No entity found for #{expr}" end class << self def for(file) # create a new view instance view = new(file) # walk the tree up to dynamically extend the view file.folder.walk_down do |e| if view_entity = e.find("_view.rb") case view_entity.ext when "rb" then view.instance_eval(view_entity.source) else raise "Unknown view extension #{view_entity.full_name}" end end end # return the finished view object view end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flutterby-0.0.10 | lib/flutterby/view.rb |