Comments (3)
Hah! That was a issue on my todo list i also wanted to bring up... I like the indirection with the injectible class and i would definitely add that to make subclassing and composing easier. There will always be cases of code that you can't include and we should make that as easy for users as possible.
But said that, why not just add type
to Mojo::Feed
? I would even go so far and add all attributes mentioned in the spec. That shouldn't be too much work and have a negligent runtime cost. And even if we worry about that, we could just use a specialised import list to generate a minimal set of accessors or an extended list. I would love to use atoms expired
to save updating feeds if they run their course. :)
from mojo-feed.
There are two points here: The one I'm looking at here is how to make Mojo::Feed and Mojo::Feed::Item extensible. feed_type()
is just a quick example, doesn't matter if it's a good idea to add that to Mojo::Feed
. For extending Mojo::Feed::Item
, I'm using your enclosures code - testing how it would look if you had to add that feature without changing the Mojo::Feed::Item
code.
The second point (the one you're making) is what are worthwhile additions to Mojo::Feed
. The current implementation is a quick-and-dirty, broadest common denominator parser. But if we go past that, it might be worth taking this more seriously and providing full access to everything feeds contain. I'm adding this as a new issue, #14
Regarding extensibility, I made a quick POC in the extend branch with pluggable classes, and I'm not sure I like that approach - it feels over-engineered rather than elegant. In Israel they say "setup for an air conditioner", because the code looks like a wall with a bricked-up hole in it (I think the more common phrase is YAGNI).
A better(?) approach might be to use with_roles
to extend the objects themselves, after they are created. This has the advantage of requiring no adaptations in Mojo::Feed
(no item_class
member, etc), but the user will need to wrap the creation of objects with a function that calls with_roles on the result.
from mojo-feed.
Yeah, you're probably right. Maybe we just just with_roles, see how often we need to extend Mojo::Feed
and how much pain the manual wrapping is? We can always add more features but it's hard to remove them ... :)
from mojo-feed.
Related Issues (11)
- Split Mojo::Feed in Mojo::Feed::Reader and Mojo::Feed HOT 1
- Import Mojolicious::Plugin::FeedReader into this module HOT 1
- Author in META.json is incorrect HOT 1
- Document enclosures HOT 1
- Support full Atom (and RSS) spec HOT 5
- Tests fail with new Mojolicious (>= 8.03) HOT 2
- Integrate autodiscovery and loading HOT 1
- Load OPML into a Mojo::Collection of Mojo::Feed objects
- Add Feed Generation Capability HOT 1
- Can't locate object method "delay" via package "Mojo::IOLoop" HOT 1
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 mojo-feed.