dmitriy_ has quit [Read error: Connection reset by peer]
arkymad has quit [Ping timeout: 240 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ta_ has quit [Ping timeout: 256 seconds]
John__ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
marr has quit [Ping timeout: 260 seconds]
alex`` has quit [Quit: WeeChat 2.0.1]
bigblind has quit [Ping timeout: 245 seconds]
arkymad has joined #ruby
d^sh has quit [Ping timeout: 240 seconds]
d^sh has joined #ruby
arkymad has quit [Ping timeout: 276 seconds]
dionysus69 has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
johnny56 has quit [Remote host closed the connection]
hahuang61 has joined #ruby
Papierkorb has joined #ruby
phaul has quit [Ping timeout: 256 seconds]
hahuang61 has quit [Ping timeout: 240 seconds]
johnny56 has joined #ruby
leitz has quit [Quit: Nappy time]
workmad3 has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
mniip has quit [Ping timeout: 240 seconds]
workmad3 has quit [Ping timeout: 256 seconds]
hightower has quit [Ping timeout: 276 seconds]
gizmore|2 is now known as gizmore
ResidentBiscuit has quit [Remote host closed the connection]
ResidentBiscuit has joined #ruby
ledestin has quit [Ping timeout: 240 seconds]
PresidentBiscuit has joined #ruby
desperek has quit [Quit: xoxo]
ta_ has quit [Ping timeout: 248 seconds]
JaredR has joined #ruby
ResidentBiscuit has quit [Ping timeout: 276 seconds]
hahuang61 has joined #ruby
PresidentBiscuit has quit [Ping timeout: 276 seconds]
hahuang61 has quit [Ping timeout: 268 seconds]
ta_ has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jnyw has joined #ruby
konsolebox has quit [Ping timeout: 256 seconds]
konsolebox has joined #ruby
karapetyan has quit [Remote host closed the connection]
konsolebox has quit [Ping timeout: 265 seconds]
karapetyan has joined #ruby
konsolebox has joined #ruby
apparition has joined #ruby
Puffball has quit [Remote host closed the connection]
karapetyan has quit [Ping timeout: 256 seconds]
upinspace__ has joined #ruby
arescorpio has joined #ruby
dviola has quit [Read error: Connection reset by peer]
upinspace__ has quit [Client Quit]
dviola has joined #ruby
upinspace__ has joined #ruby
upinspace__ has quit [Client Quit]
s3nd1v0g1us has joined #ruby
s3nd1v0g1us has quit [Max SendQ exceeded]
Fusselgesicht has quit [Quit: leaving]
konsolebox has quit [Ping timeout: 256 seconds]
Puffball has joined #ruby
konsolebox has joined #ruby
JaredR has quit []
ta_ has quit [Ping timeout: 240 seconds]
pastorinni has joined #ruby
ta_ has joined #ruby
pastorinni has quit [Remote host closed the connection]
bauruine has quit [Ping timeout: 265 seconds]
goatish has joined #ruby
shinnya has joined #ruby
bauruine has joined #ruby
konsolebox has quit [Ping timeout: 256 seconds]
konsolebox has joined #ruby
dinfuehr has quit [Ping timeout: 248 seconds]
dinfuehr has joined #ruby
cthulchu has joined #ruby
konsolebox has quit [Ping timeout: 240 seconds]
konsolebox has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Quit: AJA4350]
hahuang61 has joined #ruby
ta_ has quit [Ping timeout: 256 seconds]
hahuang61 has quit [Ping timeout: 268 seconds]
Haris has joined #ruby
<Haris>
hello all
<havenwood>
Haris: hi
<Haris>
ruby is installing gems on centos 7. Its expecting pgsql's include files somewhere under /usr/include. pgsql put them in /usr/pgsql-9.4/include. How do I reconcile this ? I tried softlinking a single file. but then it wants to search for more files
arkymad has quit [Remote host closed the connection]
<frold>
Thanks apeiros - but it seems like the limit is also set else where in the script to a max of 250 - because I can reduce it to eg 50 chars but not have more then 250 even then set to 5000
faces has joined #ruby
ta_ has quit [Ping timeout: 256 seconds]
frold has quit [Quit: Page closed]
ta_ has joined #ruby
mtkd has quit [Read error: Connection reset by peer]
mtkd has joined #ruby
jnyw has quit [Quit: WeeChat 2.0.1]
marr has joined #ruby
ta_ has quit [Ping timeout: 240 seconds]
Dimik has quit [Ping timeout: 240 seconds]
schneider has joined #ruby
ta_ has joined #ruby
red_menace has joined #ruby
bigblind has joined #ruby
red_menace has left #ruby ["bye bye..."]
phaul has joined #ruby
ta_ has quit [Ping timeout: 240 seconds]
n008f4g_ has joined #ruby
mjolnird has joined #ruby
mtkd has quit [Ping timeout: 256 seconds]
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
mtkd has joined #ruby
sidx64 has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
mtkd has quit [Read error: Connection reset by peer]
^mtkd has joined #ruby
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
^mtkd has quit [Read error: Connection reset by peer]
mtkd has joined #ruby
mtkd has quit [Read error: Connection reset by peer]
^mtkd has joined #ruby
hahuang61 has joined #ruby
^mtkd has quit [Read error: Connection reset by peer]
mtkd has joined #ruby
hahuang61 has quit [Ping timeout: 240 seconds]
goatish has joined #ruby
ta_ has joined #ruby
d^sh has quit [Ping timeout: 256 seconds]
tvw has joined #ruby
d^sh has joined #ruby
workmad3 has joined #ruby
mtkd has quit [Read error: Connection reset by peer]
kapil___ has quit [Quit: Connection closed for inactivity]
workmad3 has quit [Ping timeout: 276 seconds]
n13z has joined #ruby
ta_ has quit [Ping timeout: 268 seconds]
schneider has quit [Ping timeout: 240 seconds]
hightower has joined #ruby
Papierkorb has joined #ruby
ta_ has joined #ruby
Papierkorb has left #ruby ["Konversation terminated!"]
tolland has left #ruby ["WeeChat 0.4.3"]
milardovich has joined #ruby
faces has quit [Read error: Connection reset by peer]
antoniobeyah has quit [Quit: Connection closed for inactivity]
milardovich has quit [Ping timeout: 245 seconds]
nowhereman_ has joined #ruby
sameerynho has joined #ruby
nowhere_man has quit [Ping timeout: 260 seconds]
shinnya has quit [Ping timeout: 248 seconds]
soniya29 has joined #ruby
soniya29_ has joined #ruby
keithy has joined #ruby
n008f4g_ has quit [Ping timeout: 248 seconds]
hahuang61 has joined #ruby
konsolebox has quit [Ping timeout: 256 seconds]
sidx64_ has joined #ruby
hahuang61 has quit [Ping timeout: 256 seconds]
sidx64 has quit [Ping timeout: 256 seconds]
konsolebox has joined #ruby
keithy has quit [Quit: keithy]
AJA4350 has joined #ruby
kapil___ has joined #ruby
schneider has joined #ruby
John_Ivan has joined #ruby
John_Ivan has joined #ruby
John_Ivan has quit [Changing host]
faces has joined #ruby
ta_ has quit [Ping timeout: 245 seconds]
schneider has quit [Quit: WeeChat 2.0.1]
ta_ has joined #ruby
drewmcmillan has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
hahuang61 has joined #ruby
ta_ has joined #ruby
hahuang61 has quit [Ping timeout: 248 seconds]
schneider has joined #ruby
chromis has left #ruby [#ruby]
lemonpaul has joined #ruby
emilford has joined #ruby
<lemonpaul>
Good time for all. How to get previous element in array while iterate through it with each method?
<qyliss>
lemonpaul: Use each_cons
bigblind has quit [Ping timeout: 248 seconds]
<lemonpaul>
Ok, good. Thanks.
Haris has left #ruby [#ruby]
schneider has quit [Quit: WeeChat 2.0.1]
<lemonpaul>
How to get last index of element in array?
<apeiros>
a qyliss, btw. re "irc channels to hang out" -> #ruby-offtopic. even if it's often quite low traffic
<apeiros>
lemonpaul: index or element?
<apeiros>
ary.last for last element. ary.size - 1 for last index
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
milardovich has joined #ruby
workmad3 has quit [Ping timeout: 265 seconds]
drewmcmillan has joined #ruby
<lemonpaul>
And last question. If I want to slice elements from index 'start' to the end which range should I use? [start..-1]?
<apeiros>
yes
<apeiros>
?pry
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<apeiros>
oh well…
<apeiros>
?irb
<ruby[bot]>
irb is "interactive ruby", it is part of ruby. You can run ruby code and see results immediately. it's useful for testing code. Also see ?pry, a gem which is a popular alternative to irb.
rwb has quit [Quit: rwb]
milardovich has quit [Ping timeout: 252 seconds]
<desperek>
would something.(hello.there) work?
rabajaj has quit [Ping timeout: 256 seconds]
<apeiros>
desperek: the syntax is valid
<apeiros>
but "work" depends on so many things
<desperek>
mhm
schneider has joined #ruby
<apeiros>
for it to "work", `something` must evaluate to something which responds to #call, and can be invoked with one argument. hello must evaluate to something which responds to there. and that just means the whole expression evaluates.
<apeiros>
phaul: though with an assignment I'd vote for two statements instead of trying to be clever.
<phaul>
apeiros: agreed
<apeiros>
I omitted the record.user clause
<apeiros>
record.user == user || user.roles.exists?(division: record.division, permission: ["moderator", "admin"])
<apeiros>
and then I'd factor those parts into methods
<apeiros>
record_owner? || <has_privileges>?
<apeiros>
(find a better name for has_privileges)
<apeiros>
and the record.user relation is probably misnamed (named after the type of the relation instead of the semantics). I bet it should be record.owner # => <User>
<apeiros>
rails really shouldn't provide defaults there. I've seen soooo many misnamed relations.
gr33n7007h1 is now known as al2o3-cr
<desperek>
eh, should i refractor it then
<desperek>
or refactor
<desperek>
whatever
amelliaa has quit [Quit: -]
konsolebox has quit [Ping timeout: 248 seconds]
hndk has joined #ruby
konsolebox has joined #ruby
yadneshk has joined #ruby
konsolebox has quit [Ping timeout: 240 seconds]
<yadneshk>
i have created simple block in a class. i am trying to call the block from the function which has the same name as the block but its not working
<apeiros>
yadneshk: please gist the error you get too (even though I know what it is)
<apeiros>
("add file" and add it as a separate file)
dionysus69 has quit [Quit: dionysus69]
emilford has joined #ruby
<yadneshk>
apeiros, updated .try refreshing the link
<apeiros>
ok. so lets take it apart.
<apeiros>
./blocks.rb:6:in `<class:Myclass>': undefined method `getblock' for Myclass:Class (NoMethodError)
<apeiros>
so this tells you it happens on line 6. it tells you that there is no method `getblock` for the object Myclass (which is an instance of class)
badeball_ is now known as badeball
<yadneshk>
apeiros, so what do i do to fix it?
<apeiros>
what you do on line 6 is essentially `self.getblock`, and `self` in line 6 is Myclass. i.e. you do `Myclass.getblock`
apparition has quit [Quit: Bye]
<yadneshk>
apeiros, ok
<apeiros>
see the difference between `Myclass.new.getblock` and `Myclass.getblock`?
<apeiros>
well, "fix" depends on "what should it do?"
Azure has quit [Read error: Connection reset by peer]
Azure|dc has joined #ruby
<yadneshk>
apeiros, i am learning to create blocks. i am calling the function getblock so i want the puts statement executed
<apeiros>
ok. why are you calling it in the class body?
hahuang61 has joined #ruby
<apeiros>
`class Foo; …class body of class Foo is here…; end`
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<yadneshk>
apeiros, i didn't understand what you said
emilford has quit [Ping timeout: 248 seconds]
<apeiros>
do you know what a class body is?
hahuang61 has quit [Ping timeout: 276 seconds]
<yadneshk>
apeiros, all functions are written inside the class body, the lines of code written between class <class_name> till end is class body
<apeiros>
the last part is correct. you can define methods outside of class bodies too, though
<apeiros>
(also, use the term "method". ruby barely has any functions)
Papierkorb has left #ruby ["Konversation terminated!"]
emilford has quit [Ping timeout: 255 seconds]
<yadneshk>
apeiros, so where is this helpful? because i could also write the statement inside method instead of block
raynold has quit [Quit: Connection closed for inactivity]
<apeiros>
in so many places that it's difficult to find a good start
<apeiros>
example 1, each:
* yadneshk
now thinks that ruby may be more complicated that python
<apeiros>
[1,2,3].each do |x| …do something with each item… end
SynSynack has quit [Quit: Не разучиться мечтать... любить...]
<apeiros>
just invoking a block multiple times. in this case with a container, calling it for every element
<apeiros>
example 2, sort - provide a strategy to the sorting algorithm:
<apeiros>
people.sort { |a,b| a.first_name <=> b.first_name } # though, in almost all situations where I pass a block to sort, I prefer sort_by
<apeiros>
people.sort_by { |person| person.first_name } # sort the people array by the first name - note how I do not have to actually implement a sorting algorithm
<apeiros>
invoke code delayed (using a gem which actually supports this - not core ruby):
logoscoder has quit [Read error: Connection reset by peer]
<apeiros>
after(3.minutes) do puts "hey, 3 minutes are over" end
<apeiros>
there's plenty more use cases.
<yadneshk>
apeiros, i get the point that it's very helpful xD
<apeiros>
and yes, all of them can be solved without blocks. but blocks provide a very convenient way to solve those things.
logoscoder has joined #ruby
schneider has quit [Quit: WeeChat 2.0.1]
schneider has joined #ruby
<yadneshk>
apeiros, how many years has it been you are using ruby? just asking
<apeiros>
it = me? :D
<apeiros>
note sure. more than a decade.
emilford has joined #ruby
<yadneshk>
apeiros, holy ****. looks like i was talking to a pro!!
<apeiros>
given that I earn my money by writing ruby, that statement is correct ;-)
<yadneshk>
apeiros, it's been only 2 days since i have started learning ruby. Any advices on how i should proceed ?
logoscoder has quit [Ping timeout: 256 seconds]
<apeiros>
not really. everybody learns differently. for me, I like having a project and then work on that.
<yadneshk>
apeiros, ok i will trouble you with a last question. I am using this to learn ruby https://www.tutorialspoint.com/ruby/ . Tell me is it good or not?
bigblind has quit [Ping timeout: 276 seconds]
<apeiros>
I haven't used it, so I can't tell, sorry.
<yadneshk>
apeiros, alright. can you point me some resources for ruby?
<phaul>
apeiros: thanks, is @ruby[bot] all or are there others?
Vile` has quit [Quit: ...]
<apeiros>
there's also derpy, which provides docs. just `&ri arg` (like cmd line ri)
orbyt_ has joined #ruby
<apeiros>
though adaedra wanted to add that to ruboto (ruby[bot])
soniya29 has joined #ruby
<phaul>
ok thanks
<apeiros>
in general, bots are allowed as long as they a) don't conflict with ruby[bot], and b) don't violate any channel rules (like no spamming etc.)
soniya29_ has joined #ruby
<phaul>
asm>> 1+1
<ruby[bot]>
phaul: I have disassembled your code, the result is at https://eval.in/966467