Class: HDLRuby::High::Std::Board::SW
- Inherits:
-
Struct
- Object
- Struct
- HDLRuby::High::Std::Board::SW
- Defined in:
- lib/HDLRuby/ui/hruby_board.rb
Overview
Class describing a row of slide switches.
Instance Attribute Summary collapse
-
#hwrite ⇒ Object
Returns the value of attribute hwrite.
-
#id ⇒ Object
Returns the value of attribute id.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
Instance Attribute Details
#hwrite ⇒ Object
Returns the value of attribute hwrite
29 30 31 |
# File 'lib/HDLRuby/ui/hruby_board.rb', line 29 def hwrite @hwrite end |
#id ⇒ Object
Returns the value of attribute id
29 30 31 |
# File 'lib/HDLRuby/ui/hruby_board.rb', line 29 def id @id end |
#size ⇒ Object
Returns the value of attribute size
29 30 31 |
# File 'lib/HDLRuby/ui/hruby_board.rb', line 29 def size @size end |
Instance Method Details
#to_html ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/HDLRuby/ui/hruby_board.rb', line 30 def to_html return "<div class=\"swset\" id=\"#{self.id}\" data-value=\"0\">\\n" + '<span class="name">' + self.hwrite.to_s.chop + '</span>' + '<span> </span>' + self.size.times.map do |i| '<label class="sw"><input type="checkbox" data-bit="' + (self.size-i-1).to_s + '" ' + 'onchange="sw_change(this)">' + '<span class="sw_slider"></span></label>\n' end.join + "</div>\\n" end |