Class: Swifty
- Inherits:
-
Object
- Object
- Swifty
- 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) ⇒ Swifty
constructor
A new instance of Swifty.
- #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)
67 68 69 |
# File 'lib/swifty.rb', line 67 def method_missing(name, *args) return statement.send(name, *args) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
43 44 45 |
# File 'lib/swifty.rb', line 43 def content @content end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
43 44 45 |
# File 'lib/swifty.rb', line 43 def @options end |
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
43 44 45 |
# File 'lib/swifty.rb', line 43 def statement @statement end |
Instance Method Details
#save(file) ⇒ Object
60 61 62 63 |
# File 'lib/swifty.rb', line 60 def save(file) File.open(file, 'w+') { |f| f.write to_yaml } to_hash end |
#to_hash ⇒ Object
51 52 53 |
# File 'lib/swifty.rb', line 51 def to_hash statement.to_hash end |
#to_yaml ⇒ Object Also known as: to_yml
55 56 57 |
# File 'lib/swifty.rb', line 55 def to_yaml to_hash.to_yaml end |