photog.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A place for your photos and banter. Photog first is our motto Please refer to the site rules before posting.

Administered by:

Server stats:

242
active users

#rubylang

0 posts0 participants0 posts today

I've updated my template project of a #Bluesky feed service in #RubyLang, first time since 2023 😅

No big changes, but I brought it up to date with what I have in my (private) live project, updated it to latest gem versions, and added several new sections in the readme about how feeds work & how the app is built. #atproto

github.com/mackuba/bluesky-fee

Template of a custom feed generator service for the Bluesky network in Ruby - mackuba/bluesky-feeds-rb
GitHubGitHub - mackuba/bluesky-feeds-rb: Template of a custom feed generator service for the Bluesky network in RubyTemplate of a custom feed generator service for the Bluesky network in Ruby - mackuba/bluesky-feeds-rb

#Ruby / #RubyLang picks of the day:

➡️ @ruby - Official account of Ruby programming language

➡️ @matz - Creator of Ruby

➡️ @rubycentral - Non-profit in US supporting Ruby community, organises RubyConf & RailsConf

➡️ @rooftop - Podcast about Ruby etc

➡️ @hanami - FOSS full-stack Ruby web framework

➡️ @bridgetown - Ruby FOSS progressive site generator & full-stack framework

➡️ @ronin_rb - FOSS Ruby toolkit for security research

➡️ @wnb_rb - Meetings for women & non-binary Ruby users

🧵 1/3

Looking for programming work, available in February, need $15k+/mo.

Experience/knowledge:

- Rust (4yr)
- C (>15yr)
- Python (>10yr)
- Ruby (>15yr)
- POSIX standard
- build/release tools
- automation
- continuous integration/release
- optimization

Replied in thread

And now for #ruby!

<insert I don't know I'm doing dog here>

I'm convinced I didn't set up a venv correctly and I just installed all the dependencies to the system ruby interpreter.

Everything else was easy and modern feeling.

#rubylang

github.com/matthewdeanmartin/i

GitHubGitHub - matthewdeanmartin/isopod_ruby: Trivial text adventure game to make a basic ruby build scriptTrivial text adventure game to make a basic ruby build script - matthewdeanmartin/isopod_ruby

For any ruby :ruby: devs out there, wanted to share a neat little open-source :opensource: module I wrote to solve a common problem. Keep in mind ruby is not my main language so if there is a batter approach here I'm all ears.

Basically right now I have a game (text based mud) and in normal and expected fashion objects in the game are created when their objects get initialized, such as a new player being created. The system then periodically saves the universe by marshalling all the object into some serialized format and saves it to a file from time to time. As tends to be the case with serialization, however, when an object is restored, such as a previous player logging out and back in, then the class is created directly without the initialize method getting called , its class and instance variables are simply populated directly.

This is where problems can arise if you change the system and add new features (such as a new variable to an object). New objects that are created will populate the new variable correctly through the initialize method however already existing players will not have that variable set at all (it won't be nil, it simply wont be set, which is a distinctly different state). This is the problem I solved.

What I did was created a mix-in module that lets you set default values for variables, once a class is reinstated from storage it checked if any variables that have defaults are unset (nil variables are considered set) and then applies the default value to them. In this way legacy objects will be able to update to new code changes automatically when it loads. To prevent duplicating code you can even intentionally leave it out of the initialize method and rely on the defaults when it is appropriate to do so.

Moreover the defaults do not have to be static values but can be determined based on the existing state of the object, which makes them dynamic and flexible... a class that uses the mixin could look like this:

require 'defaults'

class Foo
include Defaults

# @bar defaults to @baz*2
default(:bar) { |this| this.baz * 2 }
# @faaboo defaults to 178
default(:faaboo) { 178 }

def initialize
@baz = 13

#this line can be ommited
@bar = 26
# if you add this line instead
load_defaults
#either work fine
end
end

Here is a link to the module:

git.qoto.org/aethyr/Aethyr/-/b

You can see a class that utilizes this new feature here:

git.qoto.org/aethyr/Aethyr/-/b

#Ruby #RubyLang #Programming #Coding #software #ComputerScience @Science #code #source #sourcecode #opensource #oss #game #gaming #gamedev #QotoJournal

I find it interesting that #Python seems to have replaced #Ruby as my go-to #scriptingLanguage?
My professional #coding experience is mostly with #RubyLang, and I've probably done the majority of my personal #scripting in it, along with #Bash script, but for the past couple of months I've mostly used #Python3.

At first it was to familiarise myself more with #PythonLang, but I can't quite put my finger on it why I'm still more likely to start a script in Python after this initial period.

dagr is a lean and mean ruby client for the IPFS api.

github.com/htrob/dagr

Regarding licence terms:

I'm releasing this under three licences (GPLv3, AGPL3, and MIT) in this particular case because my working theory is that making a p2p **library** easier to use for more people hurts centralists more, and I'm leaving it up to you to decide which will help you better to achieve that goal with your particular **application**.

github.comhtrob/dagrdagr is a lean and mean ruby client for the go-ipfs api