Packages
Packages copied to clipboard
[Ruby]Add new `BlankSlate` snippet using `BasicObject`
Description
Since Ruby 1.9, BasicObject
is available to create BlankSlate
class.
BasicObject is the parent class of all classes in Ruby. It's an explicit blank class.
BasicObject can be used for creating object hierarchies independent of Ruby's object hierarchy, proxy objects like the Delegator class, or other uses where namespace pollution from Ruby's methods and classes must be avoided.
ref. https://ruby-doc.org/core-1.9.3/BasicObject.html
I re-create BlankSlate snippet and modify tabTrigger
in order to distinguish from other Ruby class snippets.

Changes
- Use BasicObject for Ruby BlankSlate since
BasicObject
is available as of Ruby v1.9 - Change tabTrigger from
cla
toclab
since we already have some snippets triggered bycla
- Simplify snippet file name
BlankSlate
Example
The following is an example of BlankSlate
class with BasicObject
class BlankSlate < BasicObject
end
How about just not using that snippet?
Removed things tend to cause someone to complain for whatever reason. Just imagine maintainer of old code bases maybe relying on older ruby builds for some reason, which still might want that snippet.
The linked page from above says that extended maintenance for v1.9.3 ended in 2015, so I guess he has a point.
I have this Erlang conversation in mind when it comes to supporting legacy stuff. So if we don't remove keywords from a language, which have been deprecated since 2007, why should we remove things, which only date back to 2015?
The point is: There are probably dozens of out dated snippets like that. No one revized snippets for years. Removing one snippet doesn't change things nor does is it "much simpler". It's rather minor or even negligible.
Right. I'm saying both your points are valid.
@deathaxe thanks for your feedback :)
Removed things tend to cause someone to complain
Yes, that was my concern.
How about just not using that snippet?
I'm willing to do that, but I have another suggestion for this,
what about adding another trigger for that because we already have a lot of snippet for cla
.

I'd like to assign another trigger for BlankSlate
class like Ruby methods (def
+ any char).

How about adding clab
for the trigger?
What do you think about my idea?
Just in case you didn't know:
- You can ignore snippets by using
ignored_snippets
: - Overriding is also an option.
That's good to know!
I'm lazy, so it'll be great if nice snippets are available by default rather than customizing. 😸
How about adding
clab
for the trigger?
Looks like a reasonable change / trigger.
@deathaxe Hey, I've re-added Ruby BlankSlate snippets. Could you review it ❓
I hesitate approving this change because snippet's content is significantly changed. Changing trigger to reduce duplicates might be ok, but I am not sure whether changed content may cause complains.
may cause complains.
I don't think so. BasicObject
is available as of Ruby v1.9.3 and Ruby 1.9.3 EoL-ed on February 23, 2015.
I know many people are still using Ruby v2.x, but I don't know people still using Ruby v1.9 in 2023.