暦日
see gml schema
オブジェクトの生成
date : [Numeric] 日付表現 options : Hash :frame => When::TM::Calendar :era_name => When::TM::CalendarEra, When::BasicTypes::M17n or [When::BasicTypes::M17n, Integer] Integer は 当該年号の 0 年に相当する通年 :precision => Integer (Enumerated in the When::Coordinates Module) the others => see When::TM::TemporalPosition._instance
# File when/tmposition.rb, line 1391 1391: def initialize(date, options={}) 1392: # Frame 1393: @frame = When.IRI(options[:frame] || @frame || 'Gregorian', '_c:') 1394: 1395: # 年号 & 日付 1396: @calendar_era_name = options[:era_name] 1397: @calendar_era = options[:era] 1398: @cal_date = date 1399: 1400: super(options) 1401: end
ユリウス日または通年の剰余
other : When::Coordinates::Residue returns : Numeric
# File when/tmposition.rb, line 1283 1283: def %(other) 1284: raise TypeError,"The right operand should be When::Coordinates::Residue" unless Residue === other 1285: case other.unit 1286: when 'DAY' ; other % to_i 1287: when 'YEAR' ; other % cal_date[0] 1288: else ; raise ArgumentError,"The right operand should have a unit 'D' or 'Y'" 1289: end 1290: end
ユリウス日または通年が指定の剰余となる日
other : When::Coordinates::Residue returns : When::TM::CalDate
# File when/tmposition.rb, line 1259 1259: def &(other) 1260: raise TypeError,"The right operand should be When::Coordinates::Residue" unless Residue === other 1261: case other.unit 1262: when 'DAY' 1263: # 指定の剰余となる日 1264: return self.dup._copy({:events=>nil, :query=>@query, :validate=>:done, :date=>@frame.to_cal_date(other & to_i)}) 1265: 1266: when 'YEAR' 1267: # 指定の剰余となる年 1268: date = @cal_date.dup 1269: date[0] = other & date[0] 1270: return self.dup._copy({:date=>date, :events=>nil, :query=>@query}) 1271: 1272: else 1273: raise ArgumentError,"The right operand should have a unit 'D' or 'Y'" 1274: end 1275: end
下位桁の切り上げ
digit : Integer 切り上げずに残す、最下位の桁 precision : Integer (Enumerated in the When::Coordinates Module) 切り上げ結果の分解能(デフォルトは切り上げずに残した最下位の桁) returns : When::TM::CalDate
# File when/tmposition.rb, line 1318 1318: def ceil(digit=DAY, precision=digit) 1319: (self + PeriodDuration.new(1, digit, (-@frame.indices.length)..0)).floor(digit, precision) 1320: end
時法の取得 - ダミー
# File when/tmposition.rb, line 1182 1182: def clock 1183: nil 1184: end
下位桁の切り捨て
digit : Integer 切り捨てずに残す、最下位の桁 precision : Integer (Enumerated in the When::Coordinates Module) 切り捨て結果の分解能(デフォルトは切り捨てずに残した最下位の桁) returns : When::TM::CalDate
# File when/tmposition.rb, line 1302 1302: def floor(digit=DAY, precision=digit) 1303: options = {:date=>@cal_date[0..(digit-1)], :events=>nil, :query=>nil} 1304: options[:precision] = precision if precision 1305: self.dup._copy(options) 1306: end
暦年代が末端の参照であるか?
# File when/tmposition.rb, line 1323 1323: def leaf? 1324: name, = @calendar_era_name 1325: return true unless name.respond_to?(:_pool) 1326: era = name._pool['..'] 1327: return true unless era.respond_to?(:leaf?) 1328: return era.leaf? 1329: end
要素の多言語対応文字列化
index : Integer or String of When::Coordinates::PRECISION 多言語対応文字列化する要素の指定 format : When::BasicTypes::M17n 多言語対応文字列化の書式 returns : When::BasicTypes::M17n
# File when/tmposition.rb, line 1236 1236: def name(index, format=nil) 1237: digit = _digit(index) {|digit| digit <= DAY} 1238: coordinate = @cal_date[digit-1] 1239: return m17n(format % coordinate) if format 1240: 1241: indices = @frame.indices[digit-1] 1242: if indices 1243: trunk = indices.trunk 1244: branch = indices.branch 1245: end 1246: format = branch ? "%02d-" : "%02d" 1247: return m17n(format % coordinate) unless trunk 1248: trunk = trunk[coordinate * 1] 1249: return m17n(trunk) unless branch 1250: return trunk.prefix(branch[coordinate * 0]) 1251: end
ユリウス日
returns : Integer -4712-01-01T12:00:00Z からの経過日数に対応する通番(日の境界で1進める)
# File when/tmposition.rb, line 1203 1203: def to_i 1204: return @sdn if @sdn 1205: name, base = @calendar_era_name 1206: if base 1207: date = @cal_date.dup 1208: date[0] += base 1209: else 1210: date = @cal_date 1211: end 1212: @sdn = @frame.to_julian_date(date) 1213: end
多言語対応文字列化
precision : Integer (Enumerated in the When::Coordinates Module) どの桁まで多言語対応文字列化するか、分解能で指定する(デフォルト : @precision) returns : When::BasicTypes::M17n When Standard Representation により多言語対応文字列化する
# File when/tmposition.rb, line 1340 1340: def to_m17n(precision=@precision) 1341: era, = @calendar_era_name 1342: date = _date_to_s(precision) 1343: return m17n(date) unless era 1344: return m17n(era) + date 1345: end
文字列化
precision : Integer (Enumerated in the When::Coordinates Module) どの桁まで多言語対応文字列化するか、分解能で指定する(デフォルト : @precision) returns : String When Standard Representation により文字列化する
# File when/tmposition.rb, line 1356 1356: def to_s(precision=@precision) 1357: era, = @calendar_era_name 1358: date = _date_to_s(precision) 1359: return date unless era 1360: return era.to_s + date 1361: end
内部時間
returns : Numeric 当日正午の 1970-01-01T00:00:00Z からの Universal Coordinated Time の経過時間 / 128秒
# File when/tmposition.rb, line 1192 1192: def universal_time 1193: return super if [Now, Max, Min].include?(@indeterminated_position) 1194: @universal_time ||= (to_i - JulianDate::JD19700101 + 0.5) * IntervalLength::DAY 1195: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.