Class: Rouge::Theme::Style
- Inherits:
-
Hash
- Object
- Hash
- Rouge::Theme::Style
- Defined in:
- lib/rouge/theme.rb
Instance Method Summary collapse
-
#initialize(theme, hsh = {}) ⇒ Style
constructor
A new instance of Style.
- #render(selector) {|"#{selector} {"| ... } ⇒ Object
Constructor Details
#initialize(theme, hsh = {}) ⇒ Style
Returns a new instance of Style.
4 5 6 7 8 |
# File 'lib/rouge/theme.rb', line 4 def initialize(theme, hsh={}) super() @theme = theme merge!(hsh) end |
Instance Method Details
#render(selector) {|"#{selector} {"| ... } ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rouge/theme.rb', line 17 def render(selector, &b) return enum_for(:render, selector).to_a.join("\n") unless b return if empty? yield "#{selector} {" yield " color: #{fg};" if fg yield " background-color: #{bg};" if bg yield " font-weight: bold;" if self[:bold] yield " font-style: italic;" if self[:italic] yield " text-decoration: underline;" if self[:underline] (self[:rules] || []).each do |rule| yield " #{rule};" end yield "}" end |