Class: HDLRuby::High::Std::Board::SCOPE

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

Overview

Class describing an oscilloscope.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hreadObject

Returns the value of attribute hread

Returns:

  • (Object)

    the current value of hread



89
90
91
# File 'lib/HDLRuby/ui/hruby_board.rb', line 89

def hread
  @hread
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



89
90
91
# File 'lib/HDLRuby/ui/hruby_board.rb', line 89

def id
  @id
end

#maxObject

Returns the value of attribute max

Returns:

  • (Object)

    the current value of max



89
90
91
# File 'lib/HDLRuby/ui/hruby_board.rb', line 89

def max
  @max
end

#minObject

Returns the value of attribute min

Returns:

  • (Object)

    the current value of min



89
90
91
# File 'lib/HDLRuby/ui/hruby_board.rb', line 89

def min
  @min
end

Instance Method Details

#to_htmlObject



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/HDLRuby/ui/hruby_board.rb', line 90

def to_html
  # Prepare the min, max and blank strings.
  min = self.min.to_s
  max = self.max.to_s
  blank = (min.size > max.size) ? min : max;
  # Generate the html.
  return '<div>' +
      '<div class="hdiv"><div class="r-blank">' + blank + '</div>' + # just for adjusting the position with the scope.
        '<div class="scopetitle">' +self.hread.to_s + '</div>\\n' + 
      "</div>\\n" +
      '<div class="scopepane">' +
        '<div class="hdiv">\\n' +
          '<div class="y-range">' + 
            '<div class="u-value">' + max + '</div>' +
            '<div class="d-value">' + min + '</div></div>' +
          '<div class="scope" id=' + self.id.to_s +
            ' data-min="' + min + '" data-max="' + max + '"' + 
            ' data-pos="0" data-previous="0" data-value="0">' +
            '<canvas class="screen"></canvas>' +
          "</div>\\n" +
        "</div>\\n" +
        '<div class="hdiv"><div class="r-blank">' + blank + '</div>' + # just for adjusting the position with the scope.
          '<div class="x-range">' + 
            '<div class="l-value">' + "&nbsp;0&nbsp;" + '</div>' +
            '<div class="r-value">' + "100" + '</div></div>' +
          "</div>\\n" +
        "</div>\\n" +
      "</div>\\n" +
    "</div>\\n"
end