Sha256: fe7369d440bcaeb4363600dd0eb5066954c4e6116cb2135584daa8ba36aebb2c

Contents?: true

Size: 1.43 KB

Versions: 30

Compression:

Stored size: 1.43 KB

Contents


module RD
  # abstruct class for ListItem which have term part additionaly. 
  # (i.e. DescListItem and MethodListItem)
  module ComplexListItem
    def set_term(term)
      set_term_under_document_struct(term, tree.document_struct)
    end
    alias term= set_term

    def set_term_under_document_struct(term, document_struct)
      raise ArgumentError unless document_struct.is_valid?(self, term)
      assign_term(term)
    end

    def set_term_without_document_struct(term)
      assign_term(term)
    end

    def assign_term(term)
      @term = term
      term.parent = self
    end
    
    def make_term(*args_of_new, &block)
      child = self.class::Term.new(*args_of_new)
      set_term(child)
      child.build(&block) if block_given?
      child
    end

    def each_element(&block)
      yield(self)
      @term.each_element(&block)
      @description.each do |i|
	i.each_element(&block)
      end
    end
    alias each each_element
    
    def each_block_in_description
      @description.each do |i|
	yield(i)
      end
    end
    alias each_block each_block_in_description

    def children
      @description
    end

    def to_label
      @term.to_label
    end
    alias label to_label

    def inspect
      t = indent2(term.inspect) if term
      c  = children.collect{|i| indent2(i.inspect)}.join("\n")
      "<#{self.class.name}>" + (term ? "\n" : "") + t.to_s +
	(c.empty? ? "" : "\n") + c
    end
  end # ComplexListItem
end # RD

Version data entries

30 entries across 29 versions & 4 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/rdtool-0.6.38/lib/rd/complex-list-item.rb
tdiary-5.0.8 vendor/bundle/gems/rdtool-0.6.38/lib/rd/complex-list-item.rb
tdiary-5.0.5 vendor/bundle/gems/rdtool-0.6.38/lib/rd/complex-list-item.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rdtool-0.6.38/lib/rd/complex-list-item.rb
tdiary-5.0.4 vendor/bundle/gems/rdtool-0.6.38/lib/rd/complex-list-item.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/rdtool-0.6.38/lib/rd/complex-list-item.rb
nishidayuya-rd2odt-0.1.1.20090701.01 lib/rd2odt/rdtool/rd/complex-list-item.rb
nishidayuya-rd2odt-0.1.1.20090704.01 lib/rd2odt/rdtool/rd/complex-list-item.rb
nishidayuya-rd2odt-0.1.1.20090706.01 lib/rd2odt/rdtool/rd/complex-list-item.rb
nishidayuya-rd2odt-0.1.1 lib/rd2odt/rdtool/rd/complex-list-item.rb
tdiary-3.2.2.20130518 vendor/rdtool-0.6.38/lib/rd/complex-list-item.rb
tdiary-3.2.2.20130508 vendor/rdtool-0.6.38/lib/rd/complex-list-item.rb
tdiary-3.2.2.20130507 vendor/rdtool-0.6.38/lib/rd/complex-list-item.rb
rdtool-0.6.38 lib/rd/complex-list-item.rb
rdtool-0.6.37 lib/rd/complex-list-item.rb
rdtool-0.6.36 lib/rd/complex-list-item.rb
rdtool-0.6.35 lib/rd/complex-list-item.rb
rdtool-0.6.34 lib/rd/complex-list-item.rb
rdtool-0.6.33 lib/rd/complex-list-item.rb
rdtool-0.6.32 lib/rd/complex-list-item.rb