<commit_before>module Timely
  module Extensions
    # Add a WeekDays attribute
    #
    # By default it will use attribute_bit_array as db field, but this can
    # be overridden by specifying :db_field => 'somthing_else'
    def weekdays_field(attribute, options={})
      db_field = options[:db_field] || attribute.to_s + '_bit_array'
      self.composed_of(attribute,
        :class_name => "::Timely::WeekDays",
        :mapping    => [[db_field, 'weekdays_int']],
        :converter  => Proc.new {|field| ::Timely::WeekDays.new(field)}
      )
    end

    def acts_as_seasonal
      belongs_to :season
      accepts_nested_attributes_for :season
      validates_associated :season

      named_scope :season_on, lambda { |*args|
        date = args.first || Date.current # Can't assign in block in Ruby 1.8
        {
          :joins => {:season => :date_groups},
          :conditions => ["date_groups.start_date <= ? AND date_groups.end_date >= ?", date, date]
        }
      }

      named_scope :available_from, lambda { |*args|
        date = args.first || Date.current # Can't assign in block in Ruby 1.8
        {:conditions => ["boundary_end >= ?", date]}
      }

      before_save do |object|
        if object.season
          object.boundary_start = object.season.boundary_start
          object.boundary_end   = object.season.boundary_end
        end
      end
    end
  end
end
<commit_msg>Fixes bug with ambiguous module names<commit_after>module Timely
  module Extensions
    # Add a WeekDays attribute
    #
    # By default it will use attribute_bit_array as db field, but this can
    # be overridden by specifying :db_field => 'somthing_else'
    def weekdays_field(attribute, options={})
      db_field = options[:db_field] || attribute.to_s + '_bit_array'
      self.composed_of(attribute,
        :class_name => "::Timely::WeekDays",
        :mapping    => [[db_field, 'weekdays_int']],
        :converter  => Proc.new {|field| ::Timely::WeekDays.new(field)}
      )
    end

    def acts_as_seasonal
      belongs_to :season
      accepts_nested_attributes_for :season
      validates_associated :season

      named_scope :season_on, lambda { |*args|
        date = args.first || ::Date.current # Can't assign in block in Ruby 1.8
        {
          :joins => {:season => :date_groups},
          :conditions => ["date_groups.start_date <= ? AND date_groups.end_date >= ?", date, date]
        }
      }

      named_scope :available_from, lambda { |*args|
        date = args.first || ::Date.current # Can't assign in block in Ruby 1.8
        {:conditions => ["boundary_end >= ?", date]}
      }

      before_save do |object|
        if object.season
          object.boundary_start = object.season.boundary_start
          object.boundary_end   = object.season.boundary_end
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.11002102312543798, 'fraction_numerical': 0.002803083391730904, 'mean_word_length': 2.550995024875622, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 23, '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': '4529101', 'n_tokens_mistral': 894, 'n_tokens_neox': 854, 'n_words': 217}