Giter Site home page Giter Site logo

dot_hash's People

Contributors

3den avatar bitdeli-chef avatar yaauie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dot_hash's Issues

README suggestions

Would be useful to mention any reasons why someone should consider using this gem over alternatives like OpenStruct (which is in the standard library so it's usually someone's goto). For example, OpenStruct cannot handle nested hashes properly, while this gem can. I didn't know that until trying to find a reason why I would want to use this gem.

Another suggestion is to indicate in an example what happens when a key isn't found. Does it return nil or does it raise like #fetch does? If it returns nil by default, can it be configured to raise?

NoMethodError for Hash

If you have an "empty" value in a Yaml file an unfriendly error is thrown:

dog:
  bark:
  bite: "hard"
Settings.dog.bite #=> "hard"
Settings.dog.bark
#=>
NoMethodError: undefined method `bark' for #<Hash:0x007f694ee97de8>
from /home/marsalis/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/dot_hash-0.5.5/lib/dot_hash/properties.rb:45:in `public_send'

I am not sure what the best solution is here. We could 1) set empty values to nil, or 2) raise a better error message. The error message happens on Hash not the object itself. This might make it difficult to find the source of the error. In the example, there is only one bark method. But, if the setting was more generic, like username or test_mode, it would be harder to trace the error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.