Class: Tracks::SourceViewSwitching::Responder

Inherits:
Object
  • Object
show all
Defined in:
lib/tracks/source_view.rb

Instance Method Summary collapse

Constructor Details

#initialize(source_view) ⇒ Responder

Returns a new instance of Responder


8
9
10
# File 'lib/tracks/source_view.rb', line 8

def initialize(source_view)
  @source_view = source_view.underscore.gsub(/\s+/,'_').to_sym rescue nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(check_source_view, *args) ⇒ Object


20
21
22
# File 'lib/tracks/source_view.rb', line 20

def method_missing(check_source_view,*args)
  yield if check_source_view == @source_view && block_given?
end

Instance Method Details

#contextObject


16
17
18
# File 'lib/tracks/source_view.rb', line 16

def context
  yield if :context == @source_view && block_given?
end

#nil?Boolean

Returns:

  • (Boolean)

12
13
14
# File 'lib/tracks/source_view.rb', line 12

def nil?
  yield if @source_view.nil? && block_given?
end