Class: Smurf::TypographyParser
- Inherits:
-
Object
- Object
- Smurf::TypographyParser
- Defined in:
- lib/smurf/typography_parser.rb
Instance Attribute Summary collapse
-
#typographies ⇒ Object
Returns the value of attribute typographies.
-
#typography_sass_file ⇒ Object
Returns the value of attribute typography_sass_file.
Instance Method Summary collapse
-
#initialize(typography_sass_file = Smurf.typography_sass_file) ⇒ TypographyParser
constructor
A new instance of TypographyParser.
- #parse(options = {}) ⇒ Object
Constructor Details
#initialize(typography_sass_file = Smurf.typography_sass_file) ⇒ TypographyParser
Returns a new instance of TypographyParser.
7 8 9 10 |
# File 'lib/smurf/typography_parser.rb', line 7 def initialize(typography_sass_file = Smurf.typography_sass_file) @typographies = {} @typography_sass_file = typography_sass_file end |
Instance Attribute Details
#typographies ⇒ Object
Returns the value of attribute typographies.
5 6 7 |
# File 'lib/smurf/typography_parser.rb', line 5 def typographies @typographies end |
#typography_sass_file ⇒ Object
Returns the value of attribute typography_sass_file.
5 6 7 |
# File 'lib/smurf/typography_parser.rb', line 5 def typography_sass_file @typography_sass_file end |
Instance Method Details
#parse(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/smurf/typography_parser.rb', line 12 def parse( = {}) sass_tree = Sass::Engine.for_file(self.typography_sass_file, ).to_tree sass_tree.children.each do | node | if node.kind_of?(Sass::Tree::CommentNode) && is_typography_comment?(node) parsed_comment = YAML.load node.value.join.gsub!("// ", "") self.typographies[parsed_comment["styleguide_typography"]["mixin"]] = parsed_comment["styleguide_typography"]["params"] end end end |