Class: HDLRuby::High::Std::Board::SW

Inherits:
Struct
  • Object
show all
Defined in:
lib/HDLRuby/ui/hruby_board.rb

Overview

Class describing a row of slide switches.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hwriteObject

Returns the value of attribute hwrite

Returns:

  • (Object)

    the current value of hwrite



29
30
31
# File 'lib/HDLRuby/ui/hruby_board.rb', line 29

def hwrite
  @hwrite
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



29
30
31
# File 'lib/HDLRuby/ui/hruby_board.rb', line 29

def id
  @id
end

#sizeObject

Returns the value of attribute size

Returns:

  • (Object)

    the current value of size



29
30
31
# File 'lib/HDLRuby/ui/hruby_board.rb', line 29

def size
  @size
end

Instance Method Details

#to_htmlObject



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>&nbsp;&nbsp;</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