<commit_before>module MapIt
  
  module IsMappable
  
    module Base
      
      def self.included(base)
        base.extend(Config)
      end
      
      module Config
        
        def is_mappable
          class_eval do
            extend MapIt::IsMappable::Base::ClassMethods
          end
          include MapIt::IsMappable::Base::InstanceMethods
        end
        
      end
      
      module ClassMethods
        Array.class_eval do
          
          def to_markers
            set_letters
            collect {|item| item.to_marker unless item.blank?}
          end
          
          def set_letters
            letter = "A"
            each do |item|
              item.letter = letter if item.respond_to?(:letter)
              letter = letter.succ
            end
          end
          
        end
      end
      
      module InstanceMethods
        
        def to_marker
          return nil if self.latitude.zero? && self.longitude.zero?
          if self.respond_to?(:letter)
            {:letter => self.letter, :info => self.address, :latitude => self.latitude, :longitude => self.longitude}
          else
            {:info => self.address, :latitude => self.latitude, :longitude => self.longitude}
          end
        end
        
      end
      
    end
    
  end
  
end

::ActiveRecord::Base.send :include, MapIt::IsMappable::Base<commit_msg>Ensure we pass the id for making info windows.<commit_after>module MapIt
  
  module IsMappable
  
    module Base
      
      def self.included(base)
        base.extend(Config)
      end
      
      module Config
        
        def is_mappable
          class_eval do
            extend MapIt::IsMappable::Base::ClassMethods
          end
          include MapIt::IsMappable::Base::InstanceMethods
        end
        
      end
      
      module ClassMethods
        Array.class_eval do
          
          def to_markers
            set_letters
            collect {|item| item.to_marker unless item.blank?}
          end
          
          def set_letters
            letter = "A"
            each do |item|
              item.letter = letter if item.respond_to?(:letter)
              letter = letter.succ
            end
          end
          
        end
      end
      
      module InstanceMethods
        
        def to_marker
          return nil if self.latitude.zero? && self.longitude.zero?
          if self.respond_to?(:letter)
            {:letter => self.letter, :info => self.address, :latitude => self.latitude, :longitude => self.longitude, :id => self.id}
          else
            {:info => self.address, :latitude => self.latitude, :longitude => self.longitude, :id => self.id}
          end
        end
        
      end
      
    end
    
  end
  
end

::ActiveRecord::Base.send :include, MapIt::IsMappable::Base
{'fraction_non_alphanumeric': 0.07697715289982425, 'fraction_numerical': 0.0, 'mean_word_length': 1.3835845896147403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5975746', 'n_tokens_mistral': 792, 'n_tokens_neox': 786, 'n_words': 187}