Class: Cat::Skin
- Inherits:
-
Object
- Object
- Cat::Skin
- Defined in:
- lib/cat/skin.rb
Instance Method Summary collapse
- #generate(from: nil) ⇒ Object
-
#initialize ⇒ Skin
constructor
A new instance of Skin.
- #style ⇒ Object
- #var(name, value) ⇒ Object
- #variables ⇒ Object
Constructor Details
#initialize ⇒ Skin
Returns a new instance of Skin.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cat/skin.rb', line 6 def initialize @base_style = %{ body { background-color: $bgColor; } @keyframes rotating { from { transform: rotate(0deg); } to { transform: rotate(720deg); } } @keyframes speedup { 0% { transform: rotate(0deg); } 75% { transform: rotate(280deg) } 100% { transform: rotate(360deg); } } } @variables = { 'bgColor': "rgb(230, 220, 220)" } end |
Instance Method Details
#generate(from: nil) ⇒ Object
56 57 58 59 60 |
# File 'lib/cat/skin.rb', line 56 def generate(from: nil) _style = style _style << from.skins unless from.nil? SassC::Engine.new(_style).render end |
#style ⇒ Object
52 53 54 |
# File 'lib/cat/skin.rb', line 52 def style variables + @base_style end |
#var(name, value) ⇒ Object
42 43 44 |
# File 'lib/cat/skin.rb', line 42 def var(name, value) @variables[name] = value end |
#variables ⇒ Object
46 47 48 49 50 |
# File 'lib/cat/skin.rb', line 46 def variables @variables.map {|key, value| "$#{key}:#{value};" }.join("\n") end |