class PeekAView::Configuration
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/peek_a_view/configuration.rb, line 6 def initialize(*) super clear_views! end
Public Instance Methods
all_views() { |a common view object| ... }
click to toggle source
# File lib/peek_a_view/configuration.rb, line 38 def all_views(&block) # :yields: a common view object @common.tap do |common| @common << block end end
clear_views!()
click to toggle source
# File lib/peek_a_view/configuration.rb, line 24 def clear_views! @views = { } @common = [] end
load_views()
click to toggle source
# File lib/peek_a_view/configuration.rb, line 15 def load_views clear_views! if (file = views_file) load file else raise "No peek-a-view definitions found." # TODO proper exception class end end
view(*names) { |a view object| ... }
click to toggle source
# File lib/peek_a_view/configuration.rb, line 29 def view(*names, &block) # :yields: a view object raise ArgumentError, "A view must have a least one name." unless names.length > 0 names.each do |name| (@views[name] ||= PeekAView::View.new(name, @common)).tap do |view| view.record(block) end end end
views()
click to toggle source
# File lib/peek_a_view/configuration.rb, line 44 def views @views end
views_file()
click to toggle source
# File lib/peek_a_view/configuration.rb, line 11 def views_file Array(views_path).map { |p| File.join(Rails.root, p) }.find { |p| File.file?(p) } end