Class: Paggio::CSS::Definition::Gradient
- Inherits:
-
Object
- Object
- Paggio::CSS::Definition::Gradient
- Defined in:
- lib/paggio/css/definition.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #horizontal? ⇒ Boolean
-
#initialize(*args) ⇒ Gradient
constructor
TODO: all of it, seriously.
- #vertical? ⇒ Boolean
Constructor Details
#initialize(*args) ⇒ Gradient
TODO: all of it, seriously
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/paggio/css/definition.rb', line 271 def initialize(*args) = ::Hash === args.last ? args.pop : {} @to = [:to] @from = [:from] if @to && !@from @from = other(@to) elsif @from && !@to @to = other(@from) end @start = args.shift @end = args.shift end |
Instance Method Details
#each(&block) ⇒ Object
287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/paggio/css/definition.rb', line 287 def each(&block) block.call style("-moz-linear-gradient(#@to, #@start 0%, #@end 100%)") if horizontal? block.call style("-webkit-gradient(linear, #@from top, #@to top, color-stop(0%, #@start), color-stop(100%, #@end))") else block.call style("-webkit-gradient(linear, left #@from, left #@to, color-stop(0%, #@start), color-stop(100%, #@end))") end block.call style("-webkit-linear-gradient(#@to, #@start 0%, #@end 100%)") block.call style("-o-linear-gradient(#@to, #@start 0%, #@end 100%)") block.call style("-ms-linear-gradient(#@to, #@start 0%, #@end 100%)") block.call style("linear-gradient(to #@to, #@start 0%, #@end 100%)") end |
#horizontal? ⇒ Boolean
302 303 304 |
# File 'lib/paggio/css/definition.rb', line 302 def horizontal? @to == :left || @to == :right end |
#vertical? ⇒ Boolean
306 307 308 |
# File 'lib/paggio/css/definition.rb', line 306 def vertical? @to == :top || @to == :bottom end |