Class: AnsiChameleon::StyleSheetHandler
- Inherits:
-
Object
- Object
- AnsiChameleon::StyleSheetHandler
- Defined in:
- lib/ansi_chameleon/style_sheet_handler.rb
Instance Attribute Summary collapse
-
#default_values ⇒ Object
readonly
Returns the value of attribute default_values.
-
#map ⇒ Object
readonly
Returns the value of attribute map.
-
#property_name_translator ⇒ Object
readonly
Returns the value of attribute property_name_translator.
-
#tag_names ⇒ Object
readonly
Returns the value of attribute tag_names.
Instance Method Summary collapse
-
#initialize(style_sheet_hash, property_name_translator = nil) ⇒ StyleSheetHandler
constructor
A new instance of StyleSheetHandler.
- #value_for(*tag_names_chain, property_name) ⇒ Object
Constructor Details
#initialize(style_sheet_hash, property_name_translator = nil) ⇒ StyleSheetHandler
Returns a new instance of StyleSheetHandler.
4 5 6 7 8 9 10 |
# File 'lib/ansi_chameleon/style_sheet_handler.rb', line 4 def initialize(style_sheet_hash, property_name_translator=nil) @tag_names = [] @default_values = {} @map = {} @property_name_translator = property_name_translator populate_map(style_sheet_hash) end |
Instance Attribute Details
#default_values ⇒ Object (readonly)
Returns the value of attribute default_values.
12 13 14 |
# File 'lib/ansi_chameleon/style_sheet_handler.rb', line 12 def default_values @default_values end |
#map ⇒ Object (readonly)
Returns the value of attribute map.
12 13 14 |
# File 'lib/ansi_chameleon/style_sheet_handler.rb', line 12 def map @map end |
#property_name_translator ⇒ Object (readonly)
Returns the value of attribute property_name_translator.
12 13 14 |
# File 'lib/ansi_chameleon/style_sheet_handler.rb', line 12 def property_name_translator @property_name_translator end |
#tag_names ⇒ Object (readonly)
Returns the value of attribute tag_names.
12 13 14 |
# File 'lib/ansi_chameleon/style_sheet_handler.rb', line 12 def tag_names @tag_names end |
Instance Method Details
#value_for(*tag_names_chain, property_name) ⇒ Object
14 15 16 17 |
# File 'lib/ansi_chameleon/style_sheet_handler.rb', line 14 def value_for(*tag_names_chain, property_name) strongest = strongest_style_definition(*(tag_names_chain.map { |tag_name| tag_name.to_sym }), property_name.to_sym) strongest && strongest[:value] end |