Sha256: b3141aa57573c25cbdf0ec2ce3a71f38d05379f7860ba5051274a6d96a3cb950

Contents?: true

Size: 440 Bytes

Versions: 6

Compression:

Stored size: 440 Bytes

Contents

# Base Module for ViewModels.
#
module ViewModels
  
  # Extracts controllers for a living from unsuspecting views.
  #
  class ControllerExtractor
    
    attr_reader :context
    
    def initialize context
      @context = context
    end
    
    # Extracts a controller from the context.
    #
    def extract
      context = self.context
      context.respond_to?(:controller) ? context.controller : context
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
view_models-1.5.7 lib/view_models/controller_extractor.rb
view_models-1.5.6 lib/view_models/controller_extractor.rb
view_models-1.5.5 lib/view_models/controller_extractor.rb
view_models-1.5.4 lib/view_models/controller_extractor.rb
view_models-1.5.3 lib/view_models/controller_extractor.rb
view_models-1.5.2 lib/view_models/controller_extractor.rb