Sha256: f23ebe4ec26d29b056f3f7e21fa22cd27b6546fdb2161d92fd67b9b8f7adf505
Contents?: true
Size: 589 Bytes
Versions: 3
Compression:
Stored size: 589 Bytes
Contents
module Microscope class InstanceMethod attr_reader :model, :field def initialize(model, field) @model = model @field = field end def cropped_field @cropped_field ||= @field.name.gsub(@cropped_field_regex, '') end # Inject ActiveRecord scopes into a model def self.inject_instance_methods(model, fields, _options) fields.each do |field| scope = "#{field.type.to_s.camelize}InstanceMethod" "Microscope::InstanceMethod::#{scope}".constantize.new(model, field).apply if const_defined?(scope) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
microscope-1.1.1 | lib/microscope/instance_method.rb |
microscope-1.1.0 | lib/microscope/instance_method.rb |
microscope-1.0.1 | lib/microscope/instance_method.rb |