Sha256: 896d9728821038c9af36cb7fa4b5b2bb8a7ac2b322d275fb586044af0403d22b

Contents?: true

Size: 406 Bytes

Versions: 7

Compression:

Stored size: 406 Bytes

Contents

module Microscope
  class InstanceMethod
    class BooleanInstanceMethod < InstanceMethod
      def apply
        infinitive_verb = self.class.past_participle_to_infinitive(field.name)

        model.class_eval <<-RUBY, __FILE__, __LINE__ + 1
          define_method "#{infinitive_verb}!" do
            send("#{field.name}=", true)
            save!
          end
        RUBY
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
microscope-0.5.6.1 lib/microscope/instance_method/boolean_instance_method.rb
microscope-0.5.6 lib/microscope/instance_method/boolean_instance_method.rb
microscope-0.5.5 lib/microscope/instance_method/boolean_instance_method.rb
microscope-0.5.4 lib/microscope/instance_method/boolean_instance_method.rb
microscope-0.5.3 lib/microscope/instance_method/boolean_instance_method.rb
microscope-0.5.2 lib/microscope/instance_method/boolean_instance_method.rb
microscope-0.5.1 lib/microscope/instance_method/boolean_instance_method.rb