Skip to content

This module allows for the instantiation of object attributes from a hash with a simple include ObjectifyFromHash and a single method call.

Notifications You must be signed in to change notification settings

jgandt/ostend_precursor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemified and Improved at: jgandt/ostend

Using this as a mix in we are able to maintain a meaningful class structure while exposing the hash keys as viable and visable methods. I had a lot more I wanted to do in my FileCopyTask, and I didn't feel that the objectification logic was correctly placed in my class.

The really neat part about this is that you could extend an individual instance of an object and objectify it in place. You could do all sorts of other crazy things with definition of reader/writer/accessor permissions in the objectify call.

This may be entirely useless and silly but I think it is a slightly better option than returning an object of the class Hashit/ObjectifyFromHash

OpenStruct is a viable alternative. However, I was unable to find a way to use the Plain class as a mixin.

Thoughts? Comments? Need more of the code around what I'm doing? Is their an easier, clearer way (ActiveModel if working in rails)?

.jpg

About

This module allows for the instantiation of object attributes from a hash with a simple include ObjectifyFromHash and a single method call.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages