Comments (4)
Any word on this? I'm encountering this error in a script I'm trying to write. I can post a Gist if necessary.
from hashie.
I'm having the same problem when using in conjunction with mockumentary. I went back to hashie commit f299f63637
and the problem goes away, so it seems it started at the next commit. This is when Mash.new(self, self.default)
was changed to self.class.new(self, self.default)
.
from hashie.
I have a similar if not the same problem.
class Response < Hashie::Rash
attr_reader :response, :body
def initialize(response)
# yadda yadda...
end
end
And the trace
ArgumentError: wrong number of arguments (2 for 1)
from /Volumes/Users/chris/.rvm/gems/ruby-1.9.3-p194/gems/mws-0.1.23/lib/mws/response.rb:11:in `initialize'
from /Users/chris/.rvm/gems/ruby-1.9.3-p194/gems/hashie-1.2.0/lib/hashie/mash.rb:107:in `new'
from /Users/chris/.rvm/gems/ruby-1.9.3-p194/gems/hashie-1.2.0/lib/hashie/mash.rb:107:in `dup'
from /Users/chris/.rvm/gems/ruby-1.9.3-p194/gems/hashie-1.2.0/lib/hashie/hash_extensions.rb:25:in `hashie_stringify_keys'
from /Users/chris/.rvm/gems/ruby-1.9.3-p194/gems/hashie-1.2.0/lib/hashie/hash_extensions.rb:42:in `hashie_inspect'
from /Users/chris/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
Interestingly, (this is for a gem I'm writing) when I run my Rspec tests in the project folder everything works fine. When I install the code as a gem and attempt to make the same method calls that Rspec does but manually in IRB, I encounter this error.
Given that this issue still remains open after a year it looks like I'm going to have to rip Hashie out of my project and find an alternative. =(
from hashie.
If you want to have a custom #initialize
method, then you need to call super with the appropriate method signature. For example:
class Bash < Hashie::Mash
def initialize(param)
# See Hashie::Mash initialize definition for an explanation of arguments
super(nil, nil, &blk)
# your initialization here
end
end
Hope that helps!
from hashie.
Related Issues (20)
- Problem flattening multiple nested properties via Trash HOT 3
- Release v. next HOT 2
- Integer key upsets Hashie::Mash with SymbolizeKeys extension HOT 16
- Slice doesn't work using symbols HOT 5
- I got in dev a failing test from master, how to properly setup? HOT 5
- RFC: Switch to Github Actions for CI HOT 3
- Multiple Trash properties that use the same key from a source hash HOT 3
- Undefined quiet method HOT 4
- New Release? HOT 3
- Behavior change in accessing Mash values in 5.0 release HOT 5
- [Informative] `deep_symbolize_keys` broken in Rails 7 with `Mash` HOT 7
- [Question] Why use :to_sym in Hashie::Mash#convert_key HOT 1
- Release version 5 HOT 1
- Memory leak possible HOT 5
- DeepMerge changes ActiveRecord instance HOT 2
- Trash warning when translating string to symbol
- Mash.load is insecure HOT 5
- Including MethodAccessWithOverride in Hashie::Mash breaks dup method
- PredefinedValues is undefined ... :( HOT 1
- Can't call to_hash with nested `Sequel::Postgres::JSONBHash` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hashie.