Class: Swifty::Parser
- Inherits:
-
Object
- Object
- Swifty::Parser
- Defined in:
- lib/swifty.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
Instance Method Summary collapse
-
#initialize(content, **options) ⇒ Parser
constructor
A new instance of Parser.
- #save(file) ⇒ Object
- #to_hash ⇒ Object
- #to_yaml ⇒ Object (also: #to_yml)
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
68 69 70 |
# File 'lib/swifty.rb', line 68 def method_missing(name, *args) return statement.send(name, *args) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
44 45 46 |
# File 'lib/swifty.rb', line 44 def content @content end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
44 45 46 |
# File 'lib/swifty.rb', line 44 def @options end |
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
44 45 46 |
# File 'lib/swifty.rb', line 44 def statement @statement end |
Instance Method Details
#save(file) ⇒ Object
61 62 63 64 |
# File 'lib/swifty.rb', line 61 def save(file) File.open(file, 'w+') { |f| f.write to_yaml } to_hash end |
#to_hash ⇒ Object
52 53 54 |
# File 'lib/swifty.rb', line 52 def to_hash statement.to_hash end |
#to_yaml ⇒ Object Also known as: to_yml
56 57 58 |
# File 'lib/swifty.rb', line 56 def to_yaml to_hash.to_yaml end |