Class: Jacoat::Document::Link
- Inherits:
-
Object
- Object
- Jacoat::Document::Link
- Defined in:
- lib/jacoat/document/link.rb
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(arguments = {}) ⇒ Link
constructor
A new instance of Link.
- #method_missing(m, *args) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(arguments = {}) ⇒ Link
Returns a new instance of Link.
8 9 10 11 |
# File 'lib/jacoat/document/link.rb', line 8 def initialize(arguments = {}) @hash = {} process_links(arguments) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/jacoat/document/link.rb', line 13 def method_missing(m, *args) #setter if /^(\w+)=$/ =~ m @hash[:"#{$1}"] = args[0] end #getter @hash[:"#{m}"] end |
Class Method Details
Instance Method Details
#to_hash ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/jacoat/document/link.rb', line 22 def to_hash hash = {} @hash.each_pair do |k, v| hash[k] = v.to_hash end hash end |