Class: UI::Size

Inherits:
Object
  • Object
show all
Defined in:
lib/ektoplayer/ui.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width: 0, height: 0) ⇒ Size

Returns a new instance of Size.



232
233
234
# File 'lib/ektoplayer/ui.rb', line 232

def initialize(width: 0, height: 0)
   @width, @height = width, height
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



230
231
232
# File 'lib/ektoplayer/ui.rb', line 230

def height
  @height
end

#widthObject

Returns the value of attribute width.



230
231
232
# File 'lib/ektoplayer/ui.rb', line 230

def width
  @width
end

Instance Method Details

#==(s) ⇒ Object



244
# File 'lib/ektoplayer/ui.rb', line 244

def ==(s)  s.height == @height and s.width == @width    end

#calc(width: 0, height: 0) ⇒ Object



240
241
242
# File 'lib/ektoplayer/ui.rb', line 240

def calc(width: 0, height: 0)
   Size.new(width: @width + width, height: @height + height)
end

#to_sObject



245
# File 'lib/ektoplayer/ui.rb', line 245

def to_s;  "[(Size) height=#{height}, width=#{width}]"  end

#update(width: nil, height: nil) ⇒ Object



236
237
238
# File 'lib/ektoplayer/ui.rb', line 236

def update(width: nil, height: nil)
   Size.new(width: (width or @width), height: (height or @height))
end