Class: ButtonModel
- Inherits:
-
Object
- Object
- ButtonModel
- Defined in:
- lib/glimmer-dsl-web/samples/hello/hello_style.rb
Constant Summary collapse
- WIDTH_MIN =
160
- WIDTH_MAX =
960
- HEIGHT_MIN =
100
- HEIGHT_MAX =
600
- FONT_SIZE_MIN =
40
- FONT_SIZE_MAX =
200
Instance Attribute Summary collapse
-
#background_color ⇒ Object
Returns the value of attribute background_color.
-
#font_size ⇒ Object
Returns the value of attribute font_size.
-
#height ⇒ Object
Returns the value of attribute height.
-
#pushed ⇒ Object
Returns the value of attribute pushed.
-
#text ⇒ Object
Returns the value of attribute text.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #border_color ⇒ Object
-
#initialize ⇒ ButtonModel
constructor
A new instance of ButtonModel.
- #push ⇒ Object
Constructor Details
#initialize ⇒ ButtonModel
Returns a new instance of ButtonModel.
34 35 36 37 38 39 40 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_style.rb', line 34 def initialize @text = 'Push' @width = WIDTH_MIN @height = HEIGHT_MIN @font_size = FONT_SIZE_MIN @background_color = '#add8e6' end |
Instance Attribute Details
#background_color ⇒ Object
Returns the value of attribute background_color.
32 33 34 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_style.rb', line 32 def background_color @background_color end |
#font_size ⇒ Object
Returns the value of attribute font_size.
32 33 34 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_style.rb', line 32 def font_size @font_size end |
#height ⇒ Object
Returns the value of attribute height.
32 33 34 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_style.rb', line 32 def height @height end |
#pushed ⇒ Object
Returns the value of attribute pushed.
32 33 34 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_style.rb', line 32 def pushed @pushed end |
#text ⇒ Object
Returns the value of attribute text.
32 33 34 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_style.rb', line 32 def text @text end |
#width ⇒ Object
Returns the value of attribute width.
32 33 34 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_style.rb', line 32 def width @width end |
Instance Method Details
#border_color ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_style.rb', line 66 def border_color red = background_color[1..2].hex green = background_color[3..4].hex blue = background_color[5..6].hex new_red = red - 10 new_green = green - 10 new_blue = blue - 10 "##{new_red.to_s(16)}#{new_green.to_s(16)}#{new_blue.to_s(16)}" end |
#push ⇒ Object
42 43 44 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_style.rb', line 42 def push self.pushed = !pushed end |