Class: ComfortableMexicanSofa::Content::ParamsParser
- Inherits:
-
Object
- Object
- ComfortableMexicanSofa::Content::ParamsParser
- Defined in:
- lib/comfortable_mexican_sofa/content/params_parser.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- STRING_LITERAL =
%r{'[^']*'|"[^"]*"}
- IDENTIFIER =
%r{[a-z0-9][\w\-/.]*}i
- HASH_KEY =
%r{#{IDENTIFIER}:}
- COMMA =
%r{,}
- HASH_OPEN =
%r{\{}
- HASH_CLOSE =
%r{\}}
- ARRAY_OPEN =
%r{\[}
- ARRAY_CLOSE =
%r{\]}
Instance Method Summary collapse
-
#initialize(string = "") ⇒ ParamsParser
constructor
A new instance of ParamsParser.
-
#params ⇒ Array<String, {String => String}>
Takes CMS content tag parameters and converts them into array of strings, hashes and arrays.
Constructor Details
#initialize(string = "") ⇒ ParamsParser
Returns a new instance of ParamsParser.
19 20 21 |
# File 'lib/comfortable_mexican_sofa/content/params_parser.rb', line 19 def initialize(string = "") @string = string end |
Instance Method Details
#params ⇒ Array<String, {String => String}>
Takes CMS content tag parameters and converts them into array of strings, hashes and arrays.
39 40 41 42 |
# File 'lib/comfortable_mexican_sofa/content/params_parser.rb', line 39 def params @tokens = tokenize(@string) parse_params end |