Class: BitClust::Subcommands::ChmCommand::Sitemap::Content
- Includes:
- ERB::Util, Enumerable
- Defined in:
- lib/bitclust/subcommands/chm_command.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#local ⇒ Object
readonly
Returns the value of attribute local.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #<<(content) ⇒ Object
- #<=>(other) ⇒ Object
- #[](index) ⇒ Object
- #each ⇒ Object
-
#initialize(name, local = nil) ⇒ Content
constructor
A new instance of Content.
- #to_html ⇒ Object
Constructor Details
#initialize(name, local = nil) ⇒ Content
Returns a new instance of Content.
79 80 81 82 83 |
# File 'lib/bitclust/subcommands/chm_command.rb', line 79 def initialize(name, local = nil) @name = name @local = local @contents = [] end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
84 85 86 |
# File 'lib/bitclust/subcommands/chm_command.rb', line 84 def contents @contents end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
84 85 86 |
# File 'lib/bitclust/subcommands/chm_command.rb', line 84 def local @local end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
84 85 86 |
# File 'lib/bitclust/subcommands/chm_command.rb', line 84 def name @name end |
Instance Method Details
#<<(content) ⇒ Object
90 91 92 |
# File 'lib/bitclust/subcommands/chm_command.rb', line 90 def <<(content) @contents << content end |
#<=>(other) ⇒ Object
94 95 96 |
# File 'lib/bitclust/subcommands/chm_command.rb', line 94 def <=>(other) @name <=> other.name end |
#[](index) ⇒ Object
86 87 88 |
# File 'lib/bitclust/subcommands/chm_command.rb', line 86 def [](index) @contents[index] end |
#each ⇒ Object
98 99 100 101 102 |
# File 'lib/bitclust/subcommands/chm_command.rb', line 98 def each @contents.each do |content| yield content end end |
#to_html ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/bitclust/subcommands/chm_command.rb', line 104 def to_html str = "<LI> <OBJECT type=\"text/sitemap\">\n" str << " <param name=\"Name\" value=\"<%=h @name%>\">\n" if @local str << " <param name=\"Local\" value=\"<%=@local%>\">\n" end str << " </OBJECT>\n" unless contents.empty? str << "<UL>\n" @contents.each do |content| str << content.to_html end str << "</UL>\n" end ERB.new(str).result(binding) end |