Comments (6)
This is probably not something we'll do anytime soon, but I hear your concerns :(.
You're definitely right from a developer perspective. We should be namespaced for a namespace that we own. We're mostly trying to get uniformity across our different libraries and make installing easy for the average case. If we do get a bunch of complaints though, we'd consider dropping the top-level Analytics naming.
In the meantime, the best thing to do is fork and remove that line (which it looks like you already have). I remember a pull request wanting to do something similar by creating their own module instead: #9
from analytics-ruby.
+1 for adding a namespace.
It's definitely common, best practice to namespace ruby gems, especially if they use common names like Anayltics
.
Taking a look at this gem, I'd suggest completely removing AnaylticsRuby
(since that wrongly suggests you're profiling Ruby code) and namespace everything under SegmentIo
. Then, for example, you'd have:
SegmentIo::Anayltics
SegmentIo::Client
SegmentIo::Response
# And so on ...
The public API then would be accessed under that namespace as well. For example:
SegmentIo::Anayltics.identify ...
If you're concerned with consistency, you could apply this pattern to your other libraries as well. It seems like the rationale for namespacing would apply equally to Python, PHP, etc. It would be a move in the right direction.
As far a backwards compatibility, it would a simple update for folks currently using the old API: just add the SegmentIo
namespace. Or, if that's too much trouble, create an initializer with something like:
Analytics = SegmentIo::Anayltics
I totally understand this is probably not a priority. But it's obviously wrong, and I would be willing to do all the work and make a pull request.
Any chance you'd reconsider?
from analytics-ruby.
+1 because I just tried to add your gem to a rails app named "Analytics". I typed up more info in the dupe issue linked above. 😒
from analytics-ruby.
+1
from analytics-ruby.
hey guys, yeah, this has bothered me for a while. just got around to fixing it and updating our docs momentarily.
thanks for the patience!
from analytics-ruby.
Fun story. We had defined a Segment
module under which a Base
class and a few other subclasses were defined. When you folks changed the namespace to Segment::Analytics
, all the calls to Analytics.track
inside our Segment::Base
were inferred as Segment::Analytics.track
calls which obviously didn't work.
I spent way too much time scratching my head on this one. So while I was fully aware of the namespace change, I was still bit.
from analytics-ruby.
Related Issues (20)
- at_exit question HOT 1
- Error in documentation HOT 2
- Issues with sending several events at the same moment HOT 1
- anonymous_id HOT 2
- Adding message_id to track call using js2.0 style messageId fails to process HOT 2
- Using `Analytics.flush` to ensure event delivery order? HOT 4
- Empty string user id's silently fail to send events HOT 1
- window._cio.page is not a function HOT 2
- override listid for mailchimp HOT 5
- Modify timestamp to have 3 fractional digits
- Convert project to Github Actions
- Missing some tracked events in debugger HOT 2
- ::Segment is too generic a namespace HOT 1
- API returns a 200 with wrong auth key HOT 6
- Convert to Github Actions HOT 1
- wrong argument type nil (expected String) HOT 1
- [Idea] Avoid silent failures or make more noise when maximum JSON message size reached
- Nil error message in Segment::Analytics::Response object HOT 2
- Future of this gem. HOT 1
- Prep for release
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 analytics-ruby.