Class: When::CalendarNote::Week

Inherits:
When::CalendarNote show all
Defined in:
lib/when_exe/calendarnote.rb,
lib/when_exe/inspect.rb

Overview

暦週

Defined Under Namespace

Classes: DayOfWeek, Enumerator

Constant Summary

Constants inherited from When::CalendarNote

Bahai, CalendarDepend, Chinese, CommonWithRokuyo, CommonWithSovietFiveDay, CommonWithSovietSixDay, Default, Javanese, JulianDay, Mayan, Tibetan, Yis

Constants included from Namespace

Namespace::DC, Namespace::DCQ, Namespace::DCT, Namespace::FOAF, Namespace::OWL, Namespace::RDF, Namespace::RDFC, Namespace::RDFS, Namespace::RSS, Namespace::XSD

Instance Attribute Summary

Attributes inherited from When::CalendarNote

#event

Attributes inherited from TM::ReferenceSystem

#domain_of_validity, #position

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods inherited from When::CalendarNote

#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _instance, _setup_, _setup_info, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #parent, #registered?, root_dir

Methods included from Parts::Resource::Pool

#[], #[]=, #_setup_

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::Resource

Instance Method Details

#_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

#common_week(date) ⇒ When::Coordinates::Residue

七曜

Parameters:

Returns:



802
803
804
# File 'lib/when_exe/calendarnote.rb', line 802

def common_week(date)
  When.Residue('Week')[date.to_i % 7]
end

#week_labels(date) ⇒ Array<When::CalendarNote::Week::DayOfWeek>

曜日の名前の一覧



792
793
794
# File 'lib/when_exe/calendarnote.rb', line 792

def week_labels(date)
  @days_of_week.child[0...week(date)[:position].last]
end