Method: When::CalendarNote::Week#_normalize

Defined in:
lib/when_exe/calendarnote.rb

#_normalize(args = [], options = {}) ⇒ Object

オブジェクトの正規化



809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/when_exe/calendarnote.rb', line 809

def _normalize(args=[], options={})
  super
  @days_of_week ||= When.CalendarNote("#{self.class.to_s.split('::').last}/Notes::day::Week")
  @days_of_week.child.length.times do |index|
    name = @days_of_week.child[index].translate('en').downcase.gsub(/[- ]/, '_')
    self.class.module_eval %Q{
      def #{name}(date, parameter=nil)
        @days_of_week.child[#{index}].just_or_last(date)
      end
    } unless respond_to?(name)
    self.class.module_eval %Q{
      def #{name}_delta(parameter=nil)
        @days_of_week.child[#{index}].delta
      end
    } unless respond_to?(name + '_delta')
  end
end