Class: Kss::Modifier
- Inherits:
-
Object
- Object
- Kss::Modifier
- Defined in:
- lib/kss/modifier.rb
Overview
Public: Represents a style modifier. Usually a class name or a pseudo-class such as :hover. See the spec on The Modifiers Section for more information.
Instance Attribute Summary collapse
-
#description ⇒ Object
Public: Returns the description String for a Modifier.
-
#name ⇒ Object
Public: Returns the modifier name String.
Instance Method Summary collapse
-
#class_name ⇒ Object
Public: The modifier name as a CSS class.
-
#initialize(name, description = nil) ⇒ Modifier
constructor
Public: Initialize a new Modifier.
Constructor Details
#initialize(name, description = nil) ⇒ Modifier
Public: Initialize a new Modifier.
name - The name String of the modifier. description - The description String of the modifier.
17 18 19 20 |
# File 'lib/kss/modifier.rb', line 17 def initialize(name, description=nil) @name = name.to_s @description = description end |
Instance Attribute Details
#description ⇒ Object
Public: Returns the description String for a Modifier.
11 12 13 |
# File 'lib/kss/modifier.rb', line 11 def description @description end |
#name ⇒ Object
Public: Returns the modifier name String.
8 9 10 |
# File 'lib/kss/modifier.rb', line 8 def name @name end |
Instance Method Details
#class_name ⇒ Object
Public: The modifier name as a CSS class. For pseudo-classes, a generated class name is returned. Useful for generating styleguides.
Examples
:hover => "pseudo-class-hover"
sexy- => "sexy-button"
Returns a CSS class String.
31 32 33 |
# File 'lib/kss/modifier.rb', line 31 def class_name name.gsub('.', ' ').gsub(':', ' pseudo-class-').strip end |