Module: Tracks::SourceViewSwitching::Controller

Defined in:
lib/tracks/source_view.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



28
29
30
31
# File 'lib/tracks/source_view.rb', line 28

def self.included(base)
  base.send(:helper, Tracks::SourceViewSwitching::Helper)
  base.send(:helper_method, :source_view)
end

Instance Method Details

#source_viewObject



41
42
43
44
# File 'lib/tracks/source_view.rb', line 41

def source_view
  responder = Tracks::SourceViewSwitching::Responder.new(params[:_source_view] || @source_view)
  block_given? ? yield(responder) : responder
end

#source_view_is(s) ⇒ Object



33
34
35
# File 'lib/tracks/source_view.rb', line 33

def source_view_is( s )
  s == (params[:_source_view] || @source_view).to_sym
end

#source_view_is_one_of(*s) ⇒ Object



37
38
39
# File 'lib/tracks/source_view.rb', line 37

def source_view_is_one_of( *s )
  s.include?(params[:_source_view].to_sym)
end