Parent

Included Modules

Generators::HtmlMethod

Attributes

context[R]
src_url[R]
img_url[R]
source_code[R]
context[R]
src_url[R]
img_url[R]
source_code[R]

Public Class Methods

all_methods() click to toggle source
      # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 1043
1043:         def HtmlMethod.all_methods
1044:             @@all_methods
1045:         end
all_methods() click to toggle source
      # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 1043
1043:         def HtmlMethod.all_methods
1044:             @@all_methods
1045:         end
new(context, html_class, options) click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 922
922:         def initialize(context, html_class, options)
923:             @context    = context
924:             @html_class = html_class
925:             @options    = options
926:             @@m_seq       = @@m_seq.succ
927:             @m_seq        = @@m_seq
928:             @@all_methods << self
929: 
930:             context.viewer = self
931: 
932:             if (ts = @context.token_stream)
933:                 @source_code = markup_code(ts)
934:                 #unless @options.inline_source
935:                 # @src_url = create_source_code_file(@source_code)
936:                 # @img_url = MERBGenerator.gen_url(path, 'source.png')
937:                 #end
938:             end
939:             AllReferences.add(name, self)
940:         end
new(context, html_class, options) click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 922
922:         def initialize(context, html_class, options)
923:             @context    = context
924:             @html_class = html_class
925:             @options    = options
926:             @@m_seq       = @@m_seq.succ
927:             @m_seq        = @@m_seq
928:             @@all_methods << self
929: 
930:             context.viewer = self
931: 
932:             if (ts = @context.token_stream)
933:                 @source_code = markup_code(ts)
934:                 #unless @options.inline_source
935:                 # @src_url = create_source_code_file(@source_code)
936:                 # @img_url = MERBGenerator.gen_url(path, 'source.png')
937:                 #end
938:             end
939:             AllReferences.add(name, self)
940:         end
reset() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 918
918:         def HtmlMethod::reset
919:             @@all_methods = []
920:         end
reset() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 918
918:         def HtmlMethod::reset
919:             @@all_methods = []
920:         end

Public Instance Methods

<=>(other) click to toggle source
      # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 1047
1047:         def <=>(other)
1048:             @context <=> other.context
1049:         end
<=>(other) click to toggle source
      # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 1047
1047:         def <=>(other)
1048:             @context <=> other.context
1049:         end
add_line_numbers(src) click to toggle source

we rely on the fact that the first line of a source code listing has

   # File xxxxx, line dddd
      # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 1094
1094:         def add_line_numbers(src)
1095:             if src =~ /\A.*, line (\d+)/
1096:                 first = $1.to_i - 1
1097:                 last  = first + src.count("\n")
1098:                 size = last.to_s.length
1099:                 real_fmt = "%#{size}d: "
1100:                 fmt = " " * (size+2)
1101:                 src.gsub!(/^/) do
1102:                     res = sprintf(fmt, first) 
1103:                     first += 1
1104:                     fmt = real_fmt
1105:                     res
1106:                 end
1107:             end
1108:         end
add_line_numbers(src) click to toggle source

we rely on the fact that the first line of a source code listing has

   # File xxxxx, line dddd
      # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 1094
1094:         def add_line_numbers(src)
1095:             if src =~ /\A.*, line (\d+)/
1096:                 first = $1.to_i - 1
1097:                 last  = first + src.count("\n")
1098:                 size = last.to_s.length
1099:                 real_fmt = "%#{size}d: "
1100:                 fmt = " " * (size+2)
1101:                 src.gsub!(/^/) do
1102:                     res = sprintf(fmt, first) 
1103:                     first += 1
1104:                     fmt = real_fmt
1105:                     res
1106:                 end
1107:             end
1108:         end
aliases() click to toggle source
      # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 1114
1114:         def aliases
1115:             @context.aliases
1116:         end
aliases() click to toggle source
      # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 1114
1114:         def aliases
1115:             @context.aliases
1116:         end
aref() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 946
946:         def aref
947:             @m_seq
948:         end
aref() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 946
946:         def aref
947:             @m_seq
948:         end
call_seq() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 990
990:         def call_seq
991:             cs = @context.call_seq
992:             if cs
993:                 cs.gsub(/\n/, "<br />\n")
994:             else
995:                 nil
996:             end
997:         end
call_seq() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 990
990:         def call_seq
991:             cs = @context.call_seq
992:             if cs
993:                 cs.gsub(/\n/, "<br />\n")
994:             else
995:                 nil
996:             end
997:         end
create_source_code_file(code_body) click to toggle source
      # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 1025
1025:         def create_source_code_file(code_body)
1026:             meth_path = @html_class.path.sub(/\.html$/, '.src')
1027:             File.makedirs(meth_path)
1028:             file_path = File.join(meth_path, seq) + ".html"
1029: 
1030:             template = TemplatePage.new(RDoc::Page::SRC_PAGE)
1031:             File.open(file_path, "w") do |f|
1032:                 values = {
1033:                     'title'     => CGI.escapeHTML(name),
1034:                     'code'      => code_body,
1035:                     'style_url' => style_url(file_path, @options.css),
1036:                     'charset'   => @options.charset
1037:                 }
1038:                 template.write_html_on(f, values)
1039:             end
1040:             file_path
1041:         end
create_source_code_file(code_body) click to toggle source
      # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 1025
1025:         def create_source_code_file(code_body)
1026:             meth_path = @html_class.path.sub(/\.html$/, '.src')
1027:             File.makedirs(meth_path)
1028:             file_path = File.join(meth_path, seq) + ".html"
1029: 
1030:             template = TemplatePage.new(RDoc::Page::SRC_PAGE)
1031:             File.open(file_path, "w") do |f|
1032:                 values = {
1033:                     'title'     => CGI.escapeHTML(name),
1034:                     'code'      => code_body,
1035:                     'style_url' => style_url(file_path, @options.css),
1036:                     'charset'   => @options.charset
1037:                 }
1038:                 template.write_html_on(f, values)
1039:             end
1040:             file_path
1041:         end
description() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 978
978:         def description
979:             markup(@context.comment)
980:         end
description() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 978
978:         def description
979:             markup(@context.comment)
980:         end
document_self() click to toggle source
      # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 1110
1110:         def document_self
1111:             @context.document_self
1112:         end
document_self() click to toggle source
      # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 1110
1110:         def document_self
1111:             @context.document_self
1112:         end
find_symbol(symbol, method=nil) click to toggle source
      # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 1118
1118:         def find_symbol(symbol, method=nil)
1119:             res = @context.parent.find_symbol(symbol, method)
1120:             if res
1121:                 res = res.viewer
1122:             end
1123:             res
1124:         end
find_symbol(symbol, method=nil) click to toggle source
      # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 1118
1118:         def find_symbol(symbol, method=nil)
1119:             res = @context.parent.find_symbol(symbol, method)
1120:             if res
1121:                 res = res.viewer
1122:             end
1123:             res
1124:         end
markup_code(tokens) click to toggle source

Given a sequence of source tokens, mark up the source code to make it look purty.

      # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 1056
1056:         def markup_code(tokens)
1057:             src = ""
1058:             tokens.each do |t|
1059:                 next unless t
1060:                 #    p t.class
1061:                 #        style = STYLE_MAP[t.class]
1062:                 style = case t
1063:                 when RubyToken::TkCONSTANT then "ruby-constant"
1064:                 when RubyToken::TkKW       then "ruby-keyword kw"
1065:                 when RubyToken::TkIVAR     then "ruby-ivar"
1066:                 when RubyToken::TkOp       then "ruby-operator"
1067:                 when RubyToken::TkId       then "ruby-identifier"
1068:                 when RubyToken::TkNode     then "ruby-node"
1069:                 when RubyToken::TkCOMMENT  then "ruby-comment cmt"
1070:                 when RubyToken::TkREGEXP   then "ruby-regexp re"
1071:                 when RubyToken::TkSTRING   then "ruby-value str"
1072:                 when RubyToken::TkVal      then "ruby-value"
1073:                 else
1074:                     nil
1075:                 end
1076: 
1077:                 text = CGI.escapeHTML(t.text)
1078: 
1079:                 if style
1080:                     src << "<span class=\"#{style}\">#{text}</span>"
1081:                 else
1082:                     src << text
1083:                 end
1084:             end
1085: 
1086:             add_line_numbers(src)
1087:             src
1088:         end
markup_code(tokens) click to toggle source

Given a sequence of source tokens, mark up the source code to make it look purty.

      # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 1056
1056:         def markup_code(tokens)
1057:             src = ""
1058:             tokens.each do |t|
1059:                 next unless t
1060:                 #    p t.class
1061:                 #        style = STYLE_MAP[t.class]
1062:                 style = case t
1063:                 when RubyToken::TkCONSTANT then "ruby-constant"
1064:                 when RubyToken::TkKW       then "ruby-keyword kw"
1065:                 when RubyToken::TkIVAR     then "ruby-ivar"
1066:                 when RubyToken::TkOp       then "ruby-operator"
1067:                 when RubyToken::TkId       then "ruby-identifier"
1068:                 when RubyToken::TkNode     then "ruby-node"
1069:                 when RubyToken::TkCOMMENT  then "ruby-comment cmt"
1070:                 when RubyToken::TkREGEXP   then "ruby-regexp re"
1071:                 when RubyToken::TkSTRING   then "ruby-value str"
1072:                 when RubyToken::TkVal      then "ruby-value"
1073:                 else
1074:                     nil
1075:                 end
1076: 
1077:                 text = CGI.escapeHTML(t.text)
1078: 
1079:                 if style
1080:                     src << "<span class=\"#{style}\">#{text}</span>"
1081:                 else
1082:                     src << text
1083:                 end
1084:             end
1085: 
1086:             add_line_numbers(src)
1087:             src
1088:         end
name() click to toggle source

return a reference to outselves to be used as an href= the form depends on whether we’re all in one file or in multiple files

     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 958
958:         def name
959:             @context.name
960:         end
name() click to toggle source

return a reference to outselves to be used as an href= the form depends on whether we’re all in one file or in multiple files

     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 958
958:         def name
959:             @context.name
960:         end
params() click to toggle source
      # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 999
 999:         def params
1000:             # params coming from a call-seq in 'C' will start with the
1001:             # method name
1002:             p = @context.params
1003:             if p !~ /^\w/
1004:                 p = @context.params.gsub(/\s*\#.*/, '')
1005:                 p = p.tr("\n", " ").squeeze(" ")
1006:                 p = "(" + p + ")" unless p[0] == ((
1007: 
1008:                 if (block = @context.block_params)
1009:                     # If this method has explicit block parameters, remove any
1010:                     # explicit &block
1011: 
1012:                     p.sub!(/,?\s*&\w+/, '')
1013: 
1014:                     block.gsub!(/\s*\#.*/, '')
1015:                     block = block.tr("\n", " ").squeeze(" ")
1016:                     if block[0] == ((
1017:                         block.sub!(/^\(/, '').sub!(/\)/, '')
1018:                     end
1019:                     p << " {|#{block.strip}| ...}"
1020:                 end
1021:             end
1022:             CGI.escapeHTML(p)
1023:         end
params() click to toggle source
      # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 999
 999:         def params
1000:             # params coming from a call-seq in 'C' will start with the
1001:             # method name
1002:             p = @context.params
1003:             if p !~ /^\w/
1004:                 p = @context.params.gsub(/\s*\#.*/, '')
1005:                 p = p.tr("\n", " ").squeeze(" ")
1006:                 p = "(" + p + ")" unless p[0] == ((
1007: 
1008:                 if (block = @context.block_params)
1009:                     # If this method has explicit block parameters, remove any
1010:                     # explicit &block
1011: 
1012:                     p.sub!(/,?\s*&\w+/, '')
1013: 
1014:                     block.gsub!(/\s*\#.*/, '')
1015:                     block = block.tr("\n", " ").squeeze(" ")
1016:                     if block[0] == ((
1017:                         block.sub!(/^\(/, '').sub!(/\)/, '')
1018:                     end
1019:                     p << " {|#{block.strip}| ...}"
1020:                 end
1021:             end
1022:             CGI.escapeHTML(p)
1023:         end
parent_name() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 966
966:         def parent_name
967:             if @context.parent.parent
968:                 @context.parent.parent.full_name
969:             else
970:                 nil
971:             end
972:         end
parent_name() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 966
966:         def parent_name
967:             if @context.parent.parent
968:                 @context.parent.parent.full_name
969:             else
970:                 nil
971:             end
972:         end
path() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 974
974:         def path
975:             @html_class.path
976:         end
path() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 974
974:         def path
975:             @html_class.path
976:         end
scope() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 950
950:         def scope
951:             @html_class.full_name
952:         end
scope() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 950
950:         def scope
951:             @html_class.full_name
952:         end
section() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 962
962:         def section
963:             @context.section
964:         end
section() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 962
962:         def section
963:             @context.section
964:         end
seq() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 942
942:         def seq
943:             @m_seq
944:         end
seq() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 942
942:         def seq
943:             @m_seq
944:         end
singleton() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 986
986:         def singleton
987:             @context.singleton
988:         end
singleton() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 986
986:         def singleton
987:             @context.singleton
988:         end
visibility() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 982
982:         def visibility
983:             @context.visibility
984:         end
visibility() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 982
982:         def visibility
983:             @context.visibility
984:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.