Class: FileScheduler::AttributesParser::Parsing
- Defined in:
- lib/file_scheduler/attributes_parser.rb
Instance Attribute Summary collapse
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
- #attributes ⇒ Object
- #definition ⇒ Object
-
#initialize(string) ⇒ Parsing
constructor
A new instance of Parsing.
- #pairs ⇒ Object
Constructor Details
#initialize(string) ⇒ Parsing
Returns a new instance of Parsing.
12 13 14 |
# File 'lib/file_scheduler/attributes_parser.rb', line 12 def initialize(string) @string = string end |
Instance Attribute Details
#string ⇒ Object (readonly)
Returns the value of attribute string.
10 11 12 |
# File 'lib/file_scheduler/attributes_parser.rb', line 10 def string @string end |
Instance Method Details
#attributes ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/file_scheduler/attributes_parser.rb', line 29 def attributes pairs.inject({}) do |attributes, pair| key, value = pair.split("=") attributes[key.strip.to_sym] = value.strip attributes end end |
#definition ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/file_scheduler/attributes_parser.rb', line 16 def definition # Matches {...}$ or {...}.ext$ if string =~ /\{([^\}]+)\}($|\.[^.]+$)/ $1 else "" end end |
#pairs ⇒ Object
25 26 27 |
# File 'lib/file_scheduler/attributes_parser.rb', line 25 def pairs definition.split(",") end |