lib/ess/element.rb
##
# Objects of this class represent the various tags available in ESS
#
Objects of this class represent the various tags available in ESS
Objects of this class represent the various tags available in ESS
def assign_tag m, args, &block
        arg_hash = {}
        args.each { |arg| arg_hash = arg if arg.class == Hash }
        tag_list = child_tags[m] ||= [Element.new(m, @dtd[:tags][m][:dtd])]
        if args.length > 0 && args[0].class != Hash
          if @dtd[:tags][m].include? :valid_values
            unless @dtd[:tags][m][:valid_values].include?(args[0])
              raise DTD::InvalidValueError, "\"#{args[0]}\" is not a valid value for the #{m} tag"
            end
          end
          tag_list[0].text!(args[0])
        end
        arg_hash.each_pair { |key, value| tag_list[0].send([key, "_attr"].join("").to_sym, value) }
        block.call tag_list[0] if block
        run_post_processing tag_list[0]
        return tag_list[0]
      end
def assign_tag m , args , & block arg_hash = { } args . each { | arg | arg_hash = arg if arg . class == Hash } tag_list = child_tags [ m ] ||= [ Element . new ( m , @dtd [ :tags ] [ m ] [ :dtd ] ) ] if args . length > 0 && args [ 0 ] . class != Hash if @dtd [ :tags ] [ m ] . include? :valid_values unless @dtd [ :tags ] [ m ] [ :valid_values ] . include? ( args [ 0 ] ) raise DTD :: InvalidValueError , "\"#{args[0]}\" is not a valid value for the #{m} tag" end end tag_list [ 0 ] . text! ( args [ 0 ] ) end arg_hash . each_pair { | key , value | tag_list [ 0 ] . send ( [ key , "_attr" ] . join ( "" ) . to_sym , value ) } block . call tag_list [ 0 ] if block run_post_processing tag_list [ 0 ] return tag_list [ 0 ] end
Objects of this class represent the various tags available in ESS
Objects of this class represent the various tags available in ESS
m
<not_specific>
args
<not_specific>
block
<not_specific>