In Files

Class Index [+]

Quicksearch

When::Parts::IRI

International Resource Identifier

Constants

Prefix

登録済み Prefix

Attributes

child[R]

self が包含するオブジェクト

  type : [When::Parts::IRI]
namespace[R]

IRI包含階層で使用する namespace

  type : {prefix => prefix文字列}

  When::BasicTypes::M17n の生成に使用する namespace を定義する。
  RFC 5545 に対する拡張である。
  xml で記述する場合には、本ライブラリ以外でも namespace を定義している。
locale[R]

IRI包含階層で使用する locale

  type : [String]

  When::BasicTypes::M17n の生成に使用する locale を定義する。
  RFC 5545 に対する拡張である。
keys[R]

strftime で有効な locale

  type : [String]

Public Instance Methods

[](iri) click to toggle source

IRI または child の番号によるオブジェクト参照

  iri     : String or Numeric
    String  - オブジェクトの IRI
    Numeric - child の index

  returns : オブジェクト
     # File when/parts.rb, line 712
712:     def [](iri)
713:       case iri
714:       when Numeric
715:         return child[iri]
716:       when String
717:         obj = self
718:         iri.split(/::/).each do |label|
719:           return obj.child if label == '*'
720:           if obj == IRI
721:             obj = IRI._instance(label)
722:           else
723:             case label
724:             when ''  ; obj = IRI
725:             when '.' # obj = obj
726:             else     ; obj = obj._pool[label.gsub(/%3A%3A/, '::')]
727:             end
728:           end
729:           return nil unless obj
730:         end
731:         return obj
732:       else
733:         return nil
734:       end
735:     end
iri() click to toggle source

オブジェクトの IRI

 returns : Sring
     # File when/parts.rb, line 692
692:     def iri
693:       return @iri if @iri
694:       root = @_pool['..']
695:       path = root.instance_of?(String) ? root : label.to_s
696:       path = path.gsub(/::/, '%3A%3A')
697:       if (root.respond_to?(:iri))
698:         prefix = root.iri
699:         path = prefix + '::' + path if prefix
700:       end
701:       @iri = path
702:     end
leaf?() click to toggle source

オブジェクト包含階層の末端か?

  returns : Boolean
    true  - IRIが付与された他のオブジェクトを包含していない
    false - IRIが付与された他のオブジェクトを包含している
     # File when/parts.rb, line 751
751:     def leaf?
752:       !@child || (@child.length==0)
753:     end
m17n(source, options={}) click to toggle source

When::BasicTypes::M17n の生成/参照

  source  : locale と 文字列の対応
  options : Hash

see When::BasicTypes::M17n.new

  returns : When::BasicTypes::M17n
     # File when/parts.rb, line 782
782:     def m17n(source, options={})
783:       case source
784:       when Array                  ; When::BasicTypes::M17n.new(source, options)
785:       when When::BasicTypes::M17n ; source
786:       when String
787:         return self[$1] if source =~ /^\s*\[((\.{1,2}|::)+[^\]]+)\]/
788:         When::BasicTypes::M17n.new(source, options)
789:       else ; raise TypeError, "Invalid Type: #{source.class}"
790:       end
791:     end
parent() click to toggle source

self を包含するオブジェクト

  returns : When::Parts::IRI
     # File when/parts.rb, line 741
741:     def parent
742:       @_pool['..']
743:     end
registered?() click to toggle source

IRIが付与されているか?

  returns : Boolean
    true  - IRIが付与されている
    false - IRIが付与されていない
     # File when/parts.rb, line 761
761:     def registered?
762:       leaf = self
763:       while leaf._pool['..'].respond_to?(:_pool)
764:         root = leaf._pool['..']
765:         return false unless leaf.eql?(root._pool[leaf.label])
766:         leaf = root
767:       end
768:       IRI.pool_values.each do |value|
769:         return true if leaf.eql?(value)
770:       end
771:       return false
772:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.