Class: PR::BuildFromHash
- Inherits:
-
Object
- Object
- PR::BuildFromHash
- Defined in:
- lib/pr/build_from_hash.rb
Class Method Summary collapse
Instance Method Summary collapse
- #from(hash) ⇒ Object
-
#initialize(form) ⇒ BuildFromHash
constructor
A new instance of BuildFromHash.
Constructor Details
#initialize(form) ⇒ BuildFromHash
Returns a new instance of BuildFromHash.
8 9 10 |
# File 'lib/pr/build_from_hash.rb', line 8 def initialize form @form = form end |
Class Method Details
.[](form, hash) ⇒ Object
4 5 6 |
# File 'lib/pr/build_from_hash.rb', line 4 def self.[] form, hash new(form).from hash end |
Instance Method Details
#from(hash) ⇒ Object
12 13 14 15 16 |
# File 'lib/pr/build_from_hash.rb', line 12 def from hash hash.each_pair do |key,value| @form.send "#{key}=", value end end |