Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Grégory Horion
    @gregory
    Thought this would be nice to share ideas and help with support. might reduce gh issues :)
    Daniel Doubrovkine (dB.) @dblockdotorg
    @dblock
    Lets see if anyone cares ;)
    Grégory Horion
    @gregory
    yep … better than having an empty irc room :)
    Michael Herold
    @michaelherold
    Should we add a Gitter badge to the readme?
    Michael Herold
    @michaelherold
    Whoops, I see we already have :)
    Kareem Hepburn
    @magicalbanana
    I can't seem to include the Hashi::Extensions::DeepLocate
    I get a NameError: unitialized constant, any ideas?
    Michael Herold
    @michaelherold
    @magicalbanana Just out of curiosity, are you typing it wrong? In your message, you have "Hashi", when it should be "Hashie"
    Daniel Doubrovkine (dB.) @dblockdotorg
    @dblock
    DeepLocate was added on HEAD, hasn't been released yet
    Kareem Hepburn
    @magicalbanana
    @dblock Yeah, I just saw that now.
    Kareem Hepburn
    @magicalbanana

    When I tried calling this DeepLocate I get a stack level error. Any clues as to why? My class is as follows:

    https://gist.github.com/magicalbanana/96b22a400ff4ae0cd8e4

    Daniel Doubrovkine (dB.) @dblockdotorg
    @dblock
    @magicalbanana You should open an issue, I don't see anything immediately wrong
    Michael Herold
    @michaelherold
    @magicalbanana Also, a failing spec or at least an example similar to the data structure you are using would be helpful
    Kareem Hepburn
    @magicalbanana
    @michaelherold I am using Virtus.model, my error is saying that the methods are not being extended. Not sure why.
    Daniel Doubrovkine (dB.) @dblockdotorg
    @dblock

    Fyi, just released 3.4.1.

    3.4.1 (3/31/2015)

    #269: Added Hashie::Extensions::DeepLocate - @msievers.

    #270: Fixed ArgumentError raised when using IndifferentAccess and HashWithIndifferentAccess - @gardenofwine.

    #281: Added #reverse_merge to Mash to override ActiveSupport's version - @mgold.

    #282: Fixed coercions in a subclass accumulating in the superclass - @maxlinc, @martinstreicher.

    Jeremy Rodi
    @medcat
    Hiya
    Jeremy Rodi
    @medcat
    @magicalbanana on line 24, within locate_data, you call locate_data unconditionally (and since you haven't redefined it yet, it calls the method on the class), which causes a stack level error
    Grégory Horion
    @gregory
    nice! thx @dblock !
    James DeHart
    @xsmaster

    Hey All, I have a bit of a problem and I'm unable to find what I need. I'm newer to ruby so please forgive me. here is my API response that I get from rest client: "{\"status\":0,\"value\":{\"build\":{\"version\":\"1.4.8\",\"revision\":\"c8179bd8352d3c62d98fa58b324491230df9342a\"}}}"

    I placed this into a HASH and then tried to use Hashie to assign the "version" to a attribute to a class.

    What I come up with is

    var.deep_fetch :value, :build, :version
    => "1.4.8"

    What I was hoping to be able to assign the attributes a cleaner way. IDEAS?

    Michael Herold
    @michaelherold

    @xsmaster You could try using #deep_find instead.

    https://github.com/intridea/hashie/blob/master/lib/hashie/extensions/deep_find.rb

    So it would look something like:

    hash.extend(Hashie::Extensions::DeepFind)
    hash.deep_find(:version)  #=> "1.4.8"
    James DeHart
    @xsmaster
    Cool let me give that a try.
    Works!!!!
    I so need to get new glasses.
    James DeHart
    @xsmaster
    @michaelherold Bowing before the master
    Michael Herold
    @michaelherold
    Haha, glad to help
    James DeHart
    @xsmaster

    So i found this out. (RTFM)
    var.deep_find_all(:version)1
    var = {:status=>0, :value=>{:build=>{:version=>"1.4.8", :revision=>"c8179bd8352d3c62d98fa58b324491230df9342a"}, :build2=>{:version=>"1.4.9", :revision=>"c8179bd8352d3c6"}}}

    "1.4.9"

    Daniel Doubrovkine (dB.) @dblockdotorg
    @dblock
    Daniel Doubrovkine (dB.) @dblockdotorg
    @dblock
    Jesse Trimble
    @jtrim
    Hi! Using Hashie::Extensions::Coercion, I've got a bit of data I'm trying to coerce into Hash[String => Hash[String => BigDecimal]], but the BigDecimal part of that can also be nil - is there a way to handle that scenario that I'm missing (other than creating new classes to coerce to)? Getting Hashie::CoercionError: Cannot coerce property :property_name from Hash to {String=>{String=>BigDecimal}}: no implicit conversion of nil into String when I hit a nil value in that BigDecimal field
    Jesse Trimble
    @jtrim
    I suppose I could make a thin wrapper around BigDecimal that handles nil values in a better way for my use case
    Yep, that works. Sorry for posting a question I answered myself :\
    Gus P
    @staycreativedesign
    W, [2018-02-07T09:46:38.025179 #30973] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#count defined in Enumerable. This can cause unexpected behavior when accessing the key as a property. You can still access the key via the #[] method.
    how can i remove this log error?
    TL;DR: set logger to something empty, or subclass Mash and disable warnings in subclass.
    Gus P
    @staycreativedesign
    @zverok where would I put that in my rails app?
    config/initializers?
    Victor Shepelev
    @zverok
    ¯\_(ツ)_/¯
    Wherever you put this kind of stuff, initializers probably.
    Gus P
    @staycreativedesign
    config/initializers/hashie.rb:1:in `<top (required)>': uninitialized constant Hashie (NameError)
    ?!@
    Victor Shepelev
    @zverok
    probably it is still not required when initializer is called. try requireing it explicitly (or google how people typically solve this, I've never did that exact thing, just theorizing)
    Gus P
    @staycreativedesign
    yep
    hashie (3.5.7) is in my gemfile.lock
        instagram (1.1.6)
          faraday (>= 0.7, < 0.10)
          faraday_middleware (>= 0.8, < 0.10)
          hashie (>= 0.4.0)
          multi_json (~> 1.0, >= 1.0.3)
    Martin Streicher
    @martinstreicher
    @staycreativedesign Are you able to rename the count field?
    The message comes from using a key in the mash that conflicts with a built-in Mash method
    I had one called cycle that I changed to avoid issues.