Class: HDLRuby::High::Std::Board::BT

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

Overview

Class describing a row of buttons.

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



40
41
42
# File 'lib/HDLRuby/ui/hruby_board.rb', line 40

def hwrite
  @hwrite
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



40
41
42
# File 'lib/HDLRuby/ui/hruby_board.rb', line 40

def id
  @id
end

#sizeObject

Returns the value of attribute size

Returns:

  • (Object)

    the current value of size



40
41
42
# File 'lib/HDLRuby/ui/hruby_board.rb', line 40

def size
  @size
end

Instance Method Details

#to_htmlObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/HDLRuby/ui/hruby_board.rb', line 41

def to_html
  return "<div class=\"btset\" 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| 
       '<button class="bt" data-bit="' +
               (self.size-i-1).to_s + '" ' +
               'onmousedown="bt_click(this)" onmouseup="bt_release(this)" onmouseleave="bt_release(this)"><i class="bt_off"></i></button>\n'
     end.join + "</div>\\n"
end