Sha256: 8009299d6b8539255a181d1917160031c3e53bd7935e77e706fb387b3a81565b
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module BitPlayer module ContentProviders::ViewProvider def self.included(base) base.class_eval do def self.data_class(klass) @source_class = klass end def self.source_class @source_class || raise("Classes inheriting from #{ self } must define a source class with `data_class <class>`") end def self.show_nav_link @show_nav_link = true end def self.hide_nav_link @show_nav_link = false end def self.show_nav_link? @show_nav_link end def self.view_type(type) unless ['show', 'index'].include?(type) raise("view type must be one of 'show', 'index'") end @view_type = type end def self.get_view_type @view_type end end end def show_nav_link? self.class.show_nav_link? end def template "#{ plural_name }/#{ self.class.get_view_type }" end private def plural_name self.class.source_class.to_s.underscore.pluralize end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bit_player-0.1.0 | app/models/bit_player/content_providers/view_provider.rb |