havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.0, 2.5.3, 2.4.5: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
sanscoeu_ has quit [Ping timeout: 246 seconds]
jottr_ has quit [Read error: Connection reset by peer]
crankharder has joined #ruby
jottr_ has joined #ruby
\void is now known as WTFFREENODE564F4
WTFFREENODE564F4 is now known as \void
RougeR has quit [Read error: Connection reset by peer]
mikecmpbll has quit [Quit: inabit. zz.]
\void is now known as \0x766F6964
ramfjord has quit [Ping timeout: 245 seconds]
Fridtjof has joined #ruby
code_zombie has quit [Quit: Leaving]
Dbugger has quit [Quit: Leaving]
uplime has quit [Ping timeout: 250 seconds]
p0s1x has joined #ruby
p0s1x has quit [Client Quit]
lytol_ has quit [Remote host closed the connection]
fredolinhares has joined #ruby
mikecmpbll has joined #ruby
paraxial has quit [Quit: The Lounge - https://thelounge.github.io]
paraxial has joined #ruby
hutch has quit [Ping timeout: 272 seconds]
rem_ has joined #ruby
\0x766F6964 has quit [Quit: So long, and thanks for all the fish.]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
houhoulis has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
uplime has joined #ruby
hutch has joined #ruby
ellcs has joined #ruby
tdy1 has joined #ruby
bmurt has joined #ruby
tdy1 has quit [Ping timeout: 240 seconds]
hutch has quit [Ping timeout: 250 seconds]
hutch has joined #ruby
hutch has quit [Ping timeout: 245 seconds]
AJA4350 has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
tdy1 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rem_ has left #ruby [#ruby]
fredolinhares has quit [Quit: WeeChat 1.9.1]
bmurt has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_forage_ has joined #ruby
_forage_ has quit [Quit: leaving]
za1b1tsu has joined #ruby
bmurt has joined #ruby
bmurt has quit [Client Quit]
mangold has quit [Ping timeout: 268 seconds]
mangold has joined #ruby
orbyt_ has joined #ruby
bmurt has joined #ruby
Tempesta has quit [Quit: See ya!]
bmurt has quit [Client Quit]
bmurt has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gnufied has quit [Quit: Leaving]
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
hutch has joined #ruby
davidw has quit [Ping timeout: 240 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
gix has quit [Ping timeout: 240 seconds]
davidw has joined #ruby
_whitelogger has joined #ruby
houhoulis has quit [Remote host closed the connection]
\void has joined #ruby
hutch has quit [Ping timeout: 246 seconds]
sauvin has joined #ruby
hutch has joined #ruby
tdy1 has quit [Ping timeout: 246 seconds]
_whitelogger has joined #ruby
hutch has quit [Ping timeout: 250 seconds]
ziyadb has joined #ruby
Avinash has joined #ruby
hurricanehrndz has joined #ruby
Avinash has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy1 has joined #ruby
davidw has quit [Ping timeout: 250 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mroutis has joined #ruby
<mroutis> howdy :)
tdy1 is now known as tdy
<baweaver> alo
<mroutis> stay hydrated, folks
Avinash has joined #ruby
Avinash has quit [Client Quit]
Avinash has joined #ruby
rippa has joined #ruby
Avinash has quit [Client Quit]
mroutis has quit [Remote host closed the connection]
arekushi has quit [Ping timeout: 252 seconds]
Avinash has joined #ruby
dinfuehr has quit [Ping timeout: 268 seconds]
dinfuehr_ has joined #ruby
Avinash has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dinfuehr_ has quit [Ping timeout: 244 seconds]
dinfuehr has joined #ruby
danguita has joined #ruby
arekushi has joined #ruby
nowhere_man has joined #ruby
Avinash has joined #ruby
towo has quit [Ping timeout: 246 seconds]
hiroaki has joined #ruby
ziyadb has quit [Quit: Connection closed for inactivity]
Avinash has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Avinash has joined #ruby
arekushi has quit [Ping timeout: 252 seconds]
\void has quit [Quit: So long, and thanks for all the fish.]
hutch has joined #ruby
c-c has joined #ruby
<c-c> Hey how would you automate jpg to webm where each consequtive frame has -1 jpg compression quality?
<c-c> - So the image appears to degrade over time into jpg mosh
<leftylink> that sounds fun. I would consider something like running imagemagick in a loop, https://imagemagick.org/script/convert.php has the deets
<leftylink> and ffmpeg can probably put all the frames into a webm
dellavg_ has joined #ruby
ramfjord has joined #ruby
<c-c> Looks like I have mini-magick package on debian...
<c-c> - Is mini-magick legit?
tdy has quit [Ping timeout: 240 seconds]
ramfjord has quit [Ping timeout: 250 seconds]
tdy has joined #ruby
themsay has quit [Ping timeout: 245 seconds]
Avinash has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Avinash has joined #ruby
hutch has quit [Ping timeout: 246 seconds]
ramfjord has joined #ruby
Avinash has quit [Client Quit]
cthulchu has quit [Ping timeout: 250 seconds]
ramfjord has quit [Ping timeout: 245 seconds]
reber has joined #ruby
RedNifre has joined #ruby
reber has quit [Remote host closed the connection]
Avinash has joined #ruby
ellcs has joined #ruby
Fernando-Basso has joined #ruby
arekushi has joined #ruby
conta has joined #ruby
RedNifre has quit [Ping timeout: 252 seconds]
ellcs has quit [Ping timeout: 250 seconds]
RedNifre has joined #ruby
Avinash has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nowhere_man has quit [Ping timeout: 252 seconds]
gix has joined #ruby
mangold has quit [Ping timeout: 252 seconds]
mangold has joined #ruby
TaterTotMan has joined #ruby
danguita has quit [Quit: Connection closed for inactivity]
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 250 seconds]
Fusl has quit [Remote host closed the connection]
ramfjord has joined #ruby
Fusl has joined #ruby
themsay has joined #ruby
ramfjord has quit [Ping timeout: 250 seconds]
xco has joined #ruby
<xco> Hi! what does [ints][ints] do in Ruby?
<xco> nevermind :)
<phaul> wrong language? :)
<up|ime> it'll give a NameError :P
<xco> no
<xco> like this?
<xco> [1, 2, 3][0, 1]
<xco> it won’t give an error
<phaul> ah,
<phaul> slices an array
<phaul> &ri slice
<rubydoc> I found 6 entries matching method slice. Use &list slice if you would like to see a list
<phaul> ri Array#slice
<phaul> &ri Array#slice
<up|ime> more like phail
<phaul> I'm always confused by fake code, taking everything literarily...
tdy has quit [Ping timeout: 240 seconds]
<phaul> ?fake xco
<ruby[bot]> xco: Please show your real code to illustrate your problem. Using fake code often hides it or won't bring up the best possible solution.
<xco> i’m not writing anything at the moment, just random thoughts :D
<phaul> just when asking ask with runable code, ppl will take your interpretation as real code
<up|ime> i did the same, but in a more "i take this literal knowing it's not your problem"
<up|ime> easiest way to get a (11:13:48) <xco> no <xco> [1, 2, 3][0, 1]
* c-c always does [1..3][0,1]
<c-c> one less char
<phaul> c-c I think you missed the splat.
<phaul> there goes the one char saving :)
<up|ime> personally i would just do [1]
<c-c> you could also do [0,1][1..8]
xco has quit [Quit: xco]
<phaul> &list slice
<rubydoc> Array#slice, ENV.slice, Hash#slice, String#slice, Symbol#slice, Ripper.slice
<phaul> interesting that Symbol has it.
<phaul> though symbol has all sorts of String ops now.
blerrp has joined #ruby
<blerrp> imagine an rpg (game) you have different attacks (e.g. punch, kick -- each with their own damage and other attributes)
<blerrp> i've defined attacks using an Attack class
<blerrp> but now i need to keep a collection of Attack instances (each representing a different kind of attack) for use throught the project
hiroaki has quit [Ping timeout: 268 seconds]
za1b1tsu has quit [Ping timeout: 272 seconds]
<blerrp> the Attack class has Attack.name method, and that's how they're identified
<blerrp> what's a good way to maintain a collection of attacks? a list doesn't seem convenient
<blerrp> should i make an Attacks module and define the instances of Attack in there
<blerrp> and access them by doing something like Attacks.punch (to give Attack.new(name: 'punch')
<blerrp> or is that not a good way
<blerrp> another way could be to build a hash of them like {punch: Attack.new(name: 'punch'), ...}
<blerrp> Attacks = {punch: Attack.new(name: 'punch'), ...}
<phaul> these are all workable approaches but they give you slightly different behaviour. you need to consider whether a single (inmutable) attack object is ok per name or you need one dynamically ( newly created ) on each lookup by name.
<phaul> then you can think about the interface, which is an orthogonal question. Separate class, or same class class methods for lookup by name. All can work whichever interface you like better
<blerrp> i wonder if group_by could be helpful
<blerrp> on a list of Attack instances
<blerrp> mabye that's all i need
<blerrp> moves = moves_list.group_by { |m| m.name.downcase.to_sym }
<blerrp> like that i guess
Mike11 has joined #ruby
<phaul> that's fine, but is there a reason that m.name is not already a downcased sym?
<phaul> would simplify your program a lot..
hiroaki has joined #ruby
<blerrp> yeah, i'm still figuring out what will be used most often
cd has quit [Quit: cd]
hiroaki has quit [Ping timeout: 250 seconds]
reber has joined #ruby
lxsameer has joined #ruby
<blerrp> group_by is doing something weird to my objects actually
za1b1tsu has joined #ruby
<blerrp> sup with that
<phaul> group_by puts an array of objects into each groups in case there are more objects to go in a group
<blerrp> oh, so i have to access with $moves[:punch][0]
<blerrp> not so great
<phaul> &>> (1..10).group_by(&:even?)
<rubydoc> # => {false=>[1, 3, 5, 7, 9], true=>[2, 4, 6, 8, 10]} (https://carc.in/#/r/61cf)
<blerrp> yea
<phaul> are you going to have a single Attack per name?
<blerrp> yes
<phaul> are you on 2.6?
<blerrp> yes
<phaul> move_list.to_h { |attack| [attack.name, attack] }
<phaul> or move_list.to_h { |attack| [attack.name.downcase.to_sym, attack] }
<blerrp> awesome, thanks
<blerrp> and do you think that a global variable $moves_list is suitable for things like this
<phaul> I would avoid global vars at all cost
<blerrp> how would you do it considering you need it in other files that `require` the file with Move
<blerrp> and may use the move list in an initializer
<phaul> Are these attacks inmutable? Just one object per name in the entire system? Or different attack Objects per name, just not in this list?
<blerrp> like consider a Monster class in another file with `def initialize(name: 'Monster', stats: {:hp_max => 5}, moves: $moves[:punch])`
<blerrp> something like that
<blerrp> yeah, i was thinking one object per name globally
<blerrp> only one punch object
<blerrp> etc
<phaul> let me code up something quickly that shows one idea...
ellcs has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> but there are many ways to skin a cat
<blerrp> interesting
<phaul> one immediate advantage is that the commonality between certain attack types can easily be DRYed by moving them into a common superclass
<blerrp> ty phaul, i will review more
themsay has quit [Ping timeout: 246 seconds]
themsay has joined #ruby
za1b1tsu has quit [Ping timeout: 245 seconds]
Mike11 has quit [Quit: Leaving.]
AJA4350 has joined #ruby
uranoss has joined #ruby
lucasb has joined #ruby
raul782 has joined #ruby
ellcs has quit [Ping timeout: 250 seconds]
bmurt has joined #ruby
dellavg_ has quit [Ping timeout: 246 seconds]
uplime has quit [Ping timeout: 250 seconds]
Fernando-Basso has quit [Remote host closed the connection]
xrexeon has joined #ruby
xrexeon has quit [Max SendQ exceeded]
xrexeon has joined #ruby
xrexeon has quit [Max SendQ exceeded]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
VladGh has quit [Remote host closed the connection]
xrexeon has joined #ruby
bmurt has joined #ruby
segy has quit [Quit: ZNC - http://znc.in]
umjisus has quit [Quit: leaving]
uplime has joined #ruby
segy has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 250 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
Avinash has joined #ruby
raul782 has quit [Remote host closed the connection]
Emmanuel_Chanel has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
dinfuehr has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ruby
_whitelogger has joined #ruby
dinfuehr has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ruby
desperek has joined #ruby
<desperek> hi; is there anybody familiar with camping? how do i make migrations?
dinfuehr has quit [Ping timeout: 246 seconds]
jottr_ has quit [Read error: Connection reset by peer]
dinfuehr has joined #ruby
Fernando-Basso has joined #ruby
raul782 has joined #ruby
uplime has quit [Ping timeout: 246 seconds]
Avinash has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
e has joined #ruby
<desperek> it's basically not running anything
Fridtjof has quit [Quit: ZNC - http://znc.in]
nowhere_man has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
za1b1tsu has joined #ruby
hiroaki has joined #ruby
xrexeon has quit [Remote host closed the connection]
dellavg_ has joined #ruby
uplime has joined #ruby
Dbugger has joined #ruby
uplime has quit [Ping timeout: 268 seconds]
uplime has joined #ruby
raul782 has quit [Ping timeout: 272 seconds]
<phaul> desperek: it doesn't seem like camping has a lot of traction. https://github.com/camping/camping/commits/master seems about ~20 check ins in the past 4 years. what's the appeal? If you want something small, why not roda?
Fernando-Basso has quit [Remote host closed the connection]
<desperek> well, looks nice
<desperek> but then, camping is kinda more raily ://
<desperek> railsy
<desperek> aaand theeen i also think of other langs
d10n-work has joined #ruby
bmurt has joined #ruby
davidw has joined #ruby
Fridtjof has joined #ruby
hiroaki has quit [Ping timeout: 245 seconds]
hutch has joined #ruby
TaterTotMan has quit [Remote host closed the connection]
lucasb has quit [Quit: Connection closed for inactivity]
Puffball has quit [Remote host closed the connection]
orbyt_ has joined #ruby
<havenwood> desperek: Camping was a neat project by _why, but I agree there are crisper options these days unless you're just exploring.
<desperek> oh are there
<havenwood> desperek: If you'd like something Rails-ish, checkout Hanami. Or if you'd like something simple that's extensible, +1 Roda.
<havenwood> desperek: https://hanamirb.org/
<havenwood> desperek: http://roda.jeremyevans.net/
<desperek> well camping is neato
<desperek> im kinda conrerned about db
<desperek> do i just add active record to roda
<havenwood> desperek: Many folk use Sequel with Roda. Sequel and ActiveRecord are the two most popular Ruby ORMs by far.
<desperek> sequel hmm
<havenwood> desperek: Like Roda, Sequel uses a plugin pattern. Its base is simple, but you can use plugins to compose the ORM you need.
<havenwood> desperek: In Roda, the base is simple and you use plugins to compose the framework you need.
<havenwood> desperek: https://sequel.jeremyevans.net/
<havenwood> desperek: If you'd like more rails, Hanami has a defined pattern: https://guides.hanamirb.org/repositories/sql-queries/
<desperek> well, okay. i think ill check out roda+sequel more
<havenwood> i do like that path. it's fun to write all the code yourself and keep it tiny.
<desperek> true
<desperek> havenwood, im just a little bit confused. should i put my routing tree in .ru or .rb
<desperek> i guess it doesnt matter?
hutch has quit [Ping timeout: 246 seconds]
<havenwood> desperek: All Rack apps have a config.ru file (rackup file), even Rails. Typically in a Roda app you'll start with config.ru that uses the Roda app from an app.rb.
<havenwood> desperek: you're right, it doesn't really matter.
hutch has joined #ruby
za1b1tsu has quit [Remote host closed the connection]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch has quit [Ping timeout: 250 seconds]
noobineer has joined #ruby
xrexeon has joined #ruby
xrexeon has quit [Max SendQ exceeded]
xrexeon has joined #ruby
xrexeon has quit [Max SendQ exceeded]
xrexeon has joined #ruby
uranoss has quit [Quit: Connection closed for inactivity]
reber has quit [Remote host closed the connection]
tdy has joined #ruby
cthulchu has joined #ruby
noobineer has quit [Ping timeout: 246 seconds]
ghormoon has joined #ruby
<noboruma> Hi guys, is there any nice way of applying a color on string (in place) that matches a specific regex?
<phaul> noboruma: can you elaborate a bit more? Where do you want to see the colours? What interface are you talking about? terminal? web? neither?
cthulchu has quit [Ping timeout: 264 seconds]
<noboruma> phaul: woops, I should have put more detailed! I want to see those colour in terminal. I am working a CLI tool that execute some external shell commands and I would like to colourise their outputs
<noboruma> So far I have been using a combination of grep + sed, it works but I was wondering if there was a nicer, idiomatic ruby-way for such tasks
<lupine> there's a gem that lets you do "foo".color(:red)
<lupine> I don't think I'm thinking of https://github.com/fazibear/colorize but it also exists
dellavg_ has quit [Ping timeout: 245 seconds]
<phaul> noboruma: is printing strings (in colour) what you want? you also said in place.. which makes me wonder you need more terminal control
m27frogy has quit [Ping timeout: 268 seconds]
Puffball has joined #ruby
<noboruma> phaul: thank you for the links, I am checking rainbow but in my understanding, colorize "only" allow you to colorize a full string. What I want to do is colorize only certain part of a string (for instace all the numbers in red)
<noboruma> I was wondering if there is any regex tricks that could help?
m27frogy has joined #ruby
noobineer has joined #ruby
<phaul> noboruma: Im sorry I don't fully follow. You can split up a string and then apply colours to sub strings and concatenate them back together. Colour here is really nothing more that inserting a bunch of ANSI escape sequences under the hood.
<desperek> or gsub
<noboruma> phaul: yes, but my question is: what is the nicest way of achieving that (spliting+inserting) in ruby?
duderonomy has joined #ruby
<noboruma> I guess gsub might be the answer, thanks guys!
tpanarch1st has joined #ruby
d10n-work has quit [Quit: Connection closed for inactivity]
conta has quit [Quit: conta]
Fernando-Basso has joined #ruby
Spitfire has joined #ruby
barg has quit []
<desperek> havenwood, do you have any idea how do i know how to access session etc.?
<desperek> nvm i know it now
raul782 has joined #ruby
quipa has joined #ruby
raul782 has quit [Ping timeout: 246 seconds]
hutch has joined #ruby
lupine has quit [Remote host closed the connection]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
hutch has quit [Ping timeout: 268 seconds]
tdy has quit [Ping timeout: 240 seconds]
tpanarch1st has quit [Ping timeout: 240 seconds]
sanscoeur has joined #ruby
m27frogy_ has joined #ruby
m27frogy has quit [Ping timeout: 268 seconds]
lupine has joined #ruby
tdy has joined #ruby
uplime has quit [Quit: WeeChat 2.2]
sonofentropy has joined #ruby
Aqo has quit [Quit: ChatZilla 0.9.92-rdmsoft [XULRunner 35.0.1/20150122214805]]
sonofentropy has quit [Quit: sonofentropy]
\void has joined #ruby
tdy1 has joined #ruby
tdy has quit [Ping timeout: 244 seconds]
Dbugger has quit [Ping timeout: 250 seconds]
tdy1 has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
tdy1 has joined #ruby
mr_roybot has joined #ruby
cd has joined #ruby
uplime has joined #ruby
mr_roybot has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has quit [Ping timeout: 272 seconds]
hightower2 has joined #ruby
<hightower2> Hey, I 'require' a ruby file. Inside the required file, which variable or constant contains its full path?
<lupine> File.join(Dir.pwd, __FILE__)
<hightower2> great, thanks
mikecmpbll has quit [Quit: inabit. zz.]
RedNifre has quit [Ping timeout: 252 seconds]
hightower2 has left #ruby ["Leaving"]
<havenwood> hightower2: File.expand_path(__FILE__)
<havenwood> lupine: If you change the working directory, Dir.pwd won't be the dir the file is in anymore, so Ii think it's better to use `File.expand_path(__dir__)` and `File.expand_path(__FILE__)`.
<lupine> fair
Fernando-Basso has quit [Remote host closed the connection]
themsay has quit [Ping timeout: 250 seconds]
themsay has joined #ruby
orbyt_ has joined #ruby
ramfjord has joined #ruby
bmurt has joined #ruby
tdy1 has quit [Ping timeout: 246 seconds]