Class: Uttk::Dumpers::Html::BaseNode
Overview
:nodoc:
Constant Summary collapse
- @@template_images =
Html.base_url + 'images/%%%IMAGE_SPLIT%%%triangle.gif'
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#father ⇒ Object
readonly
Returns the value of attribute father.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(h) ⇒ BaseNode
constructor
A new instance of BaseNode.
- #unquote(s) ⇒ Object
Constructor Details
#initialize(h) ⇒ BaseNode
Returns a new instance of BaseNode.
60 61 62 63 |
# File 'lib/uttk/dumpers/Html.rb', line 60 def initialize ( h ) @father, @status, @id = h[:father], h[:status], h[:id] @name, @contents, @state = h[:name], h[:contents], h[:state] end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
56 57 58 |
# File 'lib/uttk/dumpers/Html.rb', line 56 def contents @contents end |
#father ⇒ Object (readonly)
Returns the value of attribute father.
56 57 58 |
# File 'lib/uttk/dumpers/Html.rb', line 56 def father @father end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
56 57 58 |
# File 'lib/uttk/dumpers/Html.rb', line 56 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
56 57 58 |
# File 'lib/uttk/dumpers/Html.rb', line 56 def name @name end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
56 57 58 |
# File 'lib/uttk/dumpers/Html.rb', line 56 def state @state end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
56 57 58 |
# File 'lib/uttk/dumpers/Html.rb', line 56 def status @status end |
Instance Method Details
#html ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/uttk/dumpers/Html.rb', line 69 def html @status ||= '' x = XmlMarkup.new x.div :class => self.class.name.demodulize.underscore do x.table :class => 'title', :id => unquote(status).sub(/\(.+\)/, '') do x.tr do if state == 2 x.td { x.text!(name.to_s + ': ') } x.td { x.pre clean_yaml_str(contents), :class => 'attribute_alone' } else x.td :width => '11px', :onClick => "uttk_toggle_state(#{id.gsub('"', "'")})" do x.img :src => @@template_images end x.td { x.text!(name.to_s) } x.td(:width => '20px') { x.text!(unquote(status).gsub('NONE', '')) } end end end end result = x.target! raise unless result =~ /<\/div>\Z/ result.sub!(/<\/div>\Z/, '') result.split('%%%IMAGE_SPLIT%%%').map do |x| x.dump end.join(', ') end |
#unquote(s) ⇒ Object
65 66 67 |
# File 'lib/uttk/dumpers/Html.rb', line 65 def unquote ( s ) s.gsub('"', '') end |