Class: HDLRuby::High::Std::Board::SLIDER

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

Overview

Class describing an "analog" slide switch.

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



58
59
60
# File 'lib/HDLRuby/ui/hruby_board.rb', line 58

def hwrite
  @hwrite
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



58
59
60
# File 'lib/HDLRuby/ui/hruby_board.rb', line 58

def id
  @id
end

#maxObject

Returns the value of attribute max

Returns:

  • (Object)

    the current value of max



58
59
60
# File 'lib/HDLRuby/ui/hruby_board.rb', line 58

def max
  @max
end

#minObject

Returns the value of attribute min

Returns:

  • (Object)

    the current value of min



58
59
60
# File 'lib/HDLRuby/ui/hruby_board.rb', line 58

def min
  @min
end

Instance Method Details

#to_htmlObject



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/HDLRuby/ui/hruby_board.rb', line 59

def to_html
  # Prepare the min, max and blank strings.
  min = self.min.to_s
  max = self.max.to_s
  return "<div class=\"sliderset\" id=\"#{self.id}\" data-value=\"0\">\\n" + 
    '<span class="name">' + self.hwrite.to_s.chop + '</span>' +
    '<span>&nbsp;&nbsp;</span>' +
    '<input type="range" min="' + min + '" max="' + max + 
      '" value="' + min + '" ' +
      'class="slider" oninput="slider_change(this)">' +
     "</div>\\n"
end