<baweaver>
that way you get a fresh rails 4 project
segy has quit [Ping timeout: 258 seconds]
<Suresh>
what do i do now?
grh has quit [Ping timeout: 260 seconds]
<feelx>
need to fix line 1-7 ;)
johnmccabe has quit [Ping timeout: 248 seconds]
charliesome has joined #ruby
<Suresh>
?
<Radar>
[16:47:55] <baweaver>you might burn that directory and: rails new chapter13
<Radar>
Suresh: ^
<Radar>
baweaver is right. You should delete that old directory and create a new Rails app with the new version of Rails that you've just installed.
<Suresh>
ok i get it
A_Drone has joined #ruby
al2o3-cr has quit [Ping timeout: 260 seconds]
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
the_drow has quit [Read error: Connection reset by peer]
<Suresh>
ok i am gonna delete mydiary
jshjsh has joined #ruby
<Suresh>
and create the same mydiary again
JoshS has quit [Disconnected by services]
jshjsh is now known as JoshS
DoubleMalt has joined #ruby
jshjsh has joined #ruby
the_drow has joined #ruby
johnmccabe has joined #ruby
ta_ has quit [Remote host closed the connection]
JoshS has quit [Disconnected by services]
jshjsh is now known as JoshS
harrisi has joined #ruby
nankyokusei has joined #ruby
redlegion has quit [Read error: Connection reset by peer]
redlegion has joined #ruby
Suresh has quit [Ping timeout: 260 seconds]
<harrisi>
I'm trying to use bindata to read a java class file (blasphemy, I know) based on the spec (https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html). I'm trying to properly read attributes, but the way that it is done is by reading some bytes which reference an index in a previously defined array and reading some data from the array (constant_pool)
<harrisi>
I figure using a bindata choice will be necessary, but I'm having trouble figuring out how to actually do it.
nankyokusei has quit [Ping timeout: 260 seconds]
the_drow has quit [Quit: This computer has gone to sleep]
<harrisi>
the code is at https://github.com/harrisi/shinypancake/blob/bindata/src/jbc.rb, if it helps. the specific class I'm troubled by is AttributeInfo (line 86). I figure a similar pattern to the CPInfo class (line 92) will be necessary, but the selection isn't just based on the tag.
Wayne_Shephard has joined #ruby
conta has joined #ruby
<harrisi>
I have to use the :attribute_name_index to index the constant_pool array, read data from that hash, and then read some amount of data based on the string contents of constant_pool[index].info.bytes
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<dminuoso>
harrisi: Let's start with something superficial.
<dminuoso>
harrisi: Get rid of these silly $_constants, and replace them with something like C_CLASS :-P
<Suresh>
just issue the command: rails generate Entry Title:string content:text
<dminuoso>
Suresh: ?rails
<dminuoso>
?rails Suresh
<ruby[bot]>
Suresh: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
nowhere_man has quit [Ping timeout: 244 seconds]
<harrisi>
dminuoso: I'm not sure what you mean.
zukin has quit [Quit: bsd is going to sleep]
<Suresh>
omg thank you
<Suresh>
IT'S WORKING NOW
<Suresh>
thank you beweaver
<dminuoso>
harrisi: $ denote (mutable) global variables, variables starting with an uppercase letter are constants.
<dminuoso>
harrisi: At any rate, you actually might have better luck with this in #jruby - there is plenty of jruby devs in there, who are intimitately familiar with Java.
<harrisi>
ironically, I had that previously (almost) but RubyMine complained about it.
<dminuoso>
(Note this is not me deferring you there, but you probably have better luck there)
blackmesa has quit [Ping timeout: 260 seconds]
<harrisi>
hm, it seems more like a question about bindata, though. I'll try.
<Suresh>
thank you those who help me just now
SteenJobs has quit [Quit: SteenJobs]
xall has joined #ruby
<dminuoso>
harrisi: Well, if you can formulate a question for just bindata that's great.
<dminuoso>
But Id say give their channel a try as well, since parsing Java classes is your goal.
ur5us has joined #ruby
<dminuoso>
harrisi: stick around here though, perhaps someone will answer your question here. :)
<harrisi>
I'm trying to formulate a more concise question and test case. essentially the problem is that one of my bindata arrays needs to reference data defined in a different record.
NTrash has joined #ruby
johnmccabe has quit [Ping timeout: 248 seconds]
redpants has quit [Quit: leaving]
dminuoso has quit [Ping timeout: 244 seconds]
Silthias has joined #ruby
gingray has joined #ruby
dminuoso has joined #ruby
A_Drone has quit []
firstdayonthejob has joined #ruby
<dminuoso>
harrisi: from what I can tell thats beyond the scope of bindata
Suresh has quit [Ping timeout: 260 seconds]
<dminuoso>
harrisi: bindata merely handles the parsing, but "referencing" is about how you interpret the data
the_drow has joined #ruby
tonini has joined #ruby
the_drow has quit [Client Quit]
segy has joined #ruby
Averna has joined #ruby
thatsnotjack has quit [Ping timeout: 244 seconds]
charliesome has joined #ruby
<harrisi>
hm. well with choices, I can give a function for how to choose which record to read. I can definitely write that function, but it needs to reference the constant_pool, which doesn't exist until after the class file has been read, but it is before the attributes are read. could I just use promises or something, potentially, to pass a promise of a constant_pool and the attribute_name_index? I'm not sure how I would fill that promise between the point of reading t
Suresh has joined #ruby
ddffg has joined #ruby
<dminuoso>
harrisi: I dont think I understand your problem.
<harrisi>
or, I suppose, a future.
<harrisi>
dminuoso: :( sorry, it's difficult for me to think about it in the first place, which makes it virtually impossible to convey what I need.
ur5us has quit [Remote host closed the connection]
timvisher has quit [Remote host closed the connection]
timvisher has joined #ruby
ur5us has joined #ruby
gingray has quit [Ping timeout: 260 seconds]
al2o3-cr has joined #ruby
<dminuoso>
harrisi: Then take a step back and simplify the problem.
lxsameer has joined #ruby
arashb has joined #ruby
<dminuoso>
harrisi: Using "futures" for this sounds like you are overcomplicating the problem.
calmchaos has joined #ruby
firstdayonthejob has quit [Ping timeout: 244 seconds]
SteenJobs has joined #ruby
SteenJobs has quit [Client Quit]
ur5us has quit [Ping timeout: 248 seconds]
rvca has quit [Ping timeout: 250 seconds]
<dminuoso>
harrisi: (In fact by starting to introduce asynchrous patterns to simple file parsing, you will probably very quickly get into messy code)
last_staff has joined #ruby
xall has quit [Ping timeout: 260 seconds]
Suresh has quit [Ping timeout: 260 seconds]
agit0 has quit [Quit: zzzZZZ….]
<harrisi>
I sure will. it does unfortunately seem like the declarative nature of BinData isn't exactly the best approach for this task. it would be relatively straightforward to just read the byte which is interpreted as the index into constant_pool and read the data offset by index (that sentence is nonsense, but I understand it in my head)
<dminuoso>
harrisi: It is great, but I think you are mistaking it for an Object model such as ActiveRecord.
arashb has quit [Ping timeout: 268 seconds]
<dminuoso>
harrisi: It's just to prevent an unmaintainable mess of using String.split + Array#unpack
<harrisi>
it's just unfortunate because the rest of the file parsing is so straightforward. does it makes sense (or is it possible) to read most of it with BinData except this specific part?
<dminuoso>
I gotta leave the train, will be back in 15-30 minutes to continue.
jgt has joined #ruby
<harrisi>
thanks!
Derperperd has quit [Ping timeout: 244 seconds]
Rickmasta has joined #ruby
grh has joined #ruby
dminuoso has quit [Remote host closed the connection]
teclator has joined #ruby
mtkd has quit [Ping timeout: 248 seconds]
vondruch_ has quit [Ping timeout: 260 seconds]
mtkd has joined #ruby
thatsnotjack has joined #ruby
al2o3-cr has quit [Ping timeout: 250 seconds]
xall has joined #ruby
Pupeno has joined #ruby
Pupeno has quit [Changing host]
Pupeno has joined #ruby
spectrum has joined #ruby
spectrum has quit [Client Quit]
zukin has joined #ruby
aganov has joined #ruby
al2o3-cr has joined #ruby
al2o3-cr is now known as Guest54061
blackgoat has quit [Ping timeout: 260 seconds]
Pupeno has quit [Remote host closed the connection]
cfec0b8d has joined #ruby
wugy has joined #ruby
blackmesa has joined #ruby
vuoto has joined #ruby
cyphase has quit [Ping timeout: 260 seconds]
nobitanobi has joined #ruby
nobitanobi has quit [Client Quit]
vuoto has quit [Remote host closed the connection]
Pupeno has joined #ruby
Pupeno has quit [Changing host]
Pupeno has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
cyphase has joined #ruby
ta_ has joined #ruby
dminuoso has joined #ruby
<dminuoso>
harrisi: Have you been able to figure this out?
edwinvdgraaf has joined #ruby
TomyWork has joined #ruby
edwinvdgraaf has quit [Client Quit]
<harrisi>
nope! I've started thinking about just parsing it byte by byte instead, though.
<dminuoso>
harrisi: That will not solve anything.
claudiuinberlin has joined #ruby
bsrd has joined #ruby
<harrisi>
hm, why do you say that?
antgel has joined #ruby
<dminuoso>
harrisi: Because bindata is exactly what tackles that problem - describing data layout, and letting you read that data based on some accessor class.
Silthias1 has joined #ruby
agit0 has joined #ruby
<dminuoso>
harrisi: It's effectively just a readable version of Array.unpack
zukin has quit [Ping timeout: 244 seconds]
<Guest54061>
dminuoso: Array#pack
submitnine has joined #ruby
<dminuoso>
Guest54061: Err, yeah. Thanks :)
vondruch_ has joined #ruby
<Guest54061>
:p
<dminuoso>
No I meant String#unpack.
<dminuoso>
Ah well.
<dminuoso>
harrisi: See, the confusion even starts with picking the right method.
<harrisi>
right, but this specific problem seems like it may be unnecessarily complex for bindata. however, it would be nice to have everything be done by bindata as it is now but for this specific piece of the file do some trickery to read some stuff by hand
Silthias has quit [Ping timeout: 260 seconds]
<dminuoso>
harrisi: Can you describe the problem in a simple test case?
<harrisi>
unfortunately no(t yet).
aufi has joined #ruby
vitd has quit [Ping timeout: 240 seconds]
JoshS has quit [Quit: Leaving]
ur5us has joined #ruby
Guest54061 is now known as al2o3-cr
al2o3-cr has quit [Changing host]
al2o3-cr has joined #ruby
<harrisi>
the way I'm thinking about the problem is this: I have a bunch of classes that read specific pieces of the byte code file. In one area (actually there are more, but they behave the same as attributes), I need to index an array (which is "grabbed"/"populated"/"created") by another class previously in the file
timvisher has quit [Remote host closed the connection]
<dminuoso>
harrisi: Sounds to me like you have coupled it too tightly to your IO.
mark_661 has joined #ruby
timvisher has joined #ruby
Humdai has joined #ruby
<dminuoso>
harrisi: Have some external class/module/method deal with this. This method would first read the "another class" containing the array, and build some abstract object that has an Ruby array, and then build the first class, which uses said abstract object.
cyphase has quit [Ping timeout: 248 seconds]
<dminuoso>
harrisi: Only use BinData classes to de-serialize, nothing more.
<harrisi>
constant_pool would be an array that is populated after line 162 (ClassFileEx.read(io))
<dminuoso>
harrisi: a choice is the equivalent of a C union, right?
<harrisi>
as far as I understand it.
<harrisi>
or just a case
qwertyco has quit [Ping timeout: 268 seconds]
<dminuoso>
harrisi: Decouple it then. Add an attribute to AttributeInfo, and initialize it with the correct selection.
dtscode has joined #ruby
<harrisi>
I should also say that this is the first ruby code I've written.
Burgestrand has joined #ruby
faces has joined #ruby
nowhere_man has joined #ruby
<dminuoso>
harrisi: With that in mind, you should use the block form of IO::open - it ensures that the IO object is closed properly. :-)
SesMan has joined #ruby
<dminuoso>
i.e. File.open("something") { |io| /* use io */ }
<harrisi>
hm, yeah.
ichkv has quit [Remote host closed the connection]
cyphase has joined #ruby
pandaant has joined #ruby
<dminuoso>
harrisi: Ohhh I finally understand your problem.
<dminuoso>
harrisi: Replace the value of your :selection with a lambda.
<dminuoso>
harrisi: With that done, you can actually do it like that. :-)
<dminuoso>
(This will evaluate the selection at runtime, requiring that you have populated that constant_pool structure before)
<harrisi>
right, but I don't understand how to reference the constant_pool array from that lambda
<dminuoso>
harrisi: The same way
SesMan has quit [Read error: Connection reset by peer]
<harrisi>
so I can just reference this.constant_pool or something?
<dminuoso>
harrisi: Sure.
<harrisi>
:o
zukin has joined #ruby
<dminuoso>
harrisi: well, is constant_pool an attribute of this class?
<harrisi>
if you look at the last line of the gist (`PP.pp(cfex.constant_pool[12].info.bytes)`), that's essentially what the lambda would be (without the call to PP.pp)
<harrisi>
constant_pool is an attribute of ClassFileEx, which is the "complete" record used for reading the whole file
SesMan has joined #ruby
<dminuoso>
harrisi: So start using classes. Use some Ruby class to describe this constant_pool and populate it.
<dminuoso>
harrisi: That way you have some "constant_pool" object that your BinData readers can use.
<harrisi>
hm
<dminuoso>
(Don't force re-using your BinData classes to maintain state - try to only use them to de-serialize data)
<dminuoso>
And populate your own data structures with them.
the_drow has joined #ruby
rbr has quit []
<harrisi>
ah, so rather than the whole ClassFileEx combining everything (which is/inherits BinData::Record), have a normal ruby class with those attributes by themselves and when populating the object just serialize each piece?
<dminuoso>
Yeah you could do that.
andikr has joined #ruby
ur5us has quit [Remote host closed the connection]
<harrisi>
was that not what you were saying? :(
ur5us has joined #ruby
rbr has joined #ruby
harai_ has joined #ruby
<harrisi>
when I said serialize, I meant deserialize.
biberu has joined #ruby
flying has joined #ruby
pawnbox has quit [Remote host closed the connection]
vuoto has joined #ruby
<dminuoso>
harrisi: Either that, or modify these classes that derive from BinData classes in a way that they are more usable.
cyphase has quit [Ping timeout: 240 seconds]
<dminuoso>
harrisi: The issue with your approach is that you require global data to connect your pieces.
Alexey|2 has joined #ruby
ur5us has quit [Ping timeout: 248 seconds]
Couch has joined #ruby
ocbtec has joined #ruby
chadwtaylor has joined #ruby
<harrisi>
I should probably read more about ruby. and serializing data. :)
cyphase has joined #ruby
chadwtaylor has quit [Ping timeout: 268 seconds]
<harrisi>
dminuoso: do you have any links/directions that would help me design a better way of accomplishing this specific task?
<dminuoso>
harrisi: Practice.
pawnbox has joined #ruby
<harrisi>
argh, but I already have so few hours in the day! :)
<dminuoso>
harrisi: Reading doesn't improve, practice does.
<dminuoso>
So it's your choice. Do you want to waste those few hours reading, or practicing?
mikecmpbll has joined #ruby
<harrisi>
practice, I suppose.
<dminuoso>
harrisi: Generally the problem with global state is that it gives no control over code floew.
<dminuoso>
Since anyone from anywhere at any time can access it.
<harrisi>
right, I'm familiar with that issue.
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<harrisi>
I just didn't care to bother doing it the right way since I intended to just work on this program for a night a few months ago.
tvw has joined #ruby
charliesome has joined #ruby
Dimik has quit [Ping timeout: 260 seconds]
<harrisi>
it was just something to sort of get more familiar with basic ruby syntax.
pawnbox has quit [Remote host closed the connection]
<harrisi>
I know that's a terrible excuse, but that was the reason for not bothering with any sort of structure or encapsulation or anything.
nankyokusei has joined #ruby
pawnbox has joined #ruby
<dminuoso>
harrisi: Reduce the scope then. Don't try to build a parser that understands everything, focus on just some bits and pieces.
<dminuoso>
That way you can write clean Ruby code with good encapsulation and good patterns
bsrd has quit [Read error: Connection reset by peer]
jcao219 has quit [Ping timeout: 244 seconds]
nankyokusei has quit [Ping timeout: 250 seconds]
SesMan has quit [Read error: Connection reset by peer]
elenatanasoiu has joined #ruby
zukin has quit [Ping timeout: 268 seconds]
vuoto has quit [Quit: Lost terminal]
SesMan has joined #ruby
cyphase has quit [Ping timeout: 260 seconds]
zukin has joined #ruby
vuoto has joined #ruby
Immune has quit [Ping timeout: 248 seconds]
Pupeno has quit [Remote host closed the connection]
the_drow has quit [Quit: Leaving]
vuoto has quit [Client Quit]
vuoto has joined #ruby
Pupeno_ has joined #ruby
blackmesa has joined #ruby
al2o3-cr has quit [Ping timeout: 260 seconds]
Pupeno_ has quit [Read error: Connection reset by peer]
bsrd has joined #ruby
Pupeno has joined #ruby
gingray has joined #ruby
cyphase has joined #ruby
jaequery has joined #ruby
wingwalker has joined #ruby
salut has joined #ruby
conta has quit [Quit: conta]
mim1k|wo1k is now known as mim1k|work
blackmesa has quit [Ping timeout: 260 seconds]
ichkv has joined #ruby
arne_ has joined #ruby
arne_ is now known as Bish
<Bish>
hi folkies! if i want to share data between subclasses, is it dirty to do that via instance variables of a class?
<ljarvis>
that's exactly how you should do it
vuoto has quit [Quit: Lost terminal]
<ljarvis>
although without seeing code that's probably not good advise :)
<matthewd>
Then maybe you should just use overloaded methods
<dminuoso>
Bish: It's very simple.
<Bish>
by_subclass.send(:initialize_subclass, @visible_fields || []) <= what does this do, i mean the second parameter will just be visible_fields or empty array
<Bish>
how does initialize_subclass know what to do?
<dminuoso>
Bish: it's defined above.
<Bish>
oh, i am an idiot
<dminuoso>
Bish: the trick is just the inherited method itself, its a callback that is automatically called when someone derives from your class
vuoto has quit [Remote host closed the connection]
jahmalz has joined #ruby
<dminuoso>
I pre-initialize the sub-class with the fields from the base class.
<dminuoso>
alternatively you could have the visible_fields accessor walk the inheritance chain
kent\n has quit [Remote host closed the connection]
dn`_ has joined #ruby
jeyraof has joined #ruby
lempa has joined #ruby
Axy has joined #ruby
Axy has joined #ruby
ta__ has joined #ruby
helpa-bot has joined #ruby
jsrn_ has joined #ruby
timvishe` has joined #ruby
<dminuoso>
Bish: Im not a big fan of this inherited callback though, so I would opt for the latter approach.
GinoMan2440Wrx has joined #ruby
Asher1 has joined #ruby
tdy1 has joined #ruby
LoneHe___ has joined #ruby
Nahra` has joined #ruby
vondruch has joined #ruby
aurelien` has joined #ruby
SesMan has quit [Read error: Connection reset by peer]
<matthewd>
dminuoso: Careful.. that's starting to sound like how Rails works. And that's apparently a no-go.
K7 has quit [Quit: Connection closed for inactivity]
helpa-bot has quit [Remote host closed the connection]
helpa-bot has joined #ruby
olivierjanss_ has joined #ruby
statelesscode_ has joined #ruby
<dminuoso>
matthewd: Yeah. It's an an inversion of responsibilies. A base class should not know about sub-classes.
kent\n has joined #ruby
juanfra has quit [Disconnected by services]
sonOfRa_ has joined #ruby
juanfra_ has joined #ruby
SesMan has joined #ruby
daemoen_ has joined #ruby
Talltree_ has joined #ruby
bronson_ has joined #ruby
Gnubie__ has joined #ruby
Toledo has joined #ruby
knight- has joined #ruby
<matthewd>
There are also implications for post-inheritance mutation of the parent
helpa-bot has quit [Remote host closed the connection]
wildleaf_ has joined #ruby
scottala1 has joined #ruby
gigetoo_ has joined #ruby
ljarvis_ has joined #ruby
helpa-bot has joined #ruby
ericwood_ has joined #ruby
isomorph1smes has joined #ruby
dn`_ has quit [Client Quit]
<dminuoso>
matthewd: Yeah. Though Im not a big fan of reopening classes either.
Bish_ has joined #ruby
<Bish_>
what is the best way to access them in instances?
GooseYAr1 has joined #ruby
crankhar1er has joined #ruby
<Bish_>
what is the best way to access them in instances?*
ptx0_ has joined #ruby
ltd_ has joined #ruby
Sp4rKy_ has joined #ruby
raldu_ has joined #ruby
krandi has joined #ruby
fbt_ has joined #ruby
shadeslayer_ has joined #ruby
<dminuoso>
Bish: self.class.visibile_attributes
Prira_ has joined #ruby
alnewkir1 has joined #ruby
KnownSyntax_ has joined #ruby
dn`_ has joined #ruby
Kuukunen- has joined #ruby
compass_ has joined #ruby
pandaant_ has joined #ruby
bairyn_ has joined #ruby
dn`_ has quit [Client Quit]
helpa-bot has quit [Remote host closed the connection]
drbrain_ has joined #ruby
yasu____ has joined #ruby
helpa-bot has joined #ruby
ljarvis has quit [Disconnected by services]
ljarvis_ is now known as ljarvis
pwnd_nsfw has joined #ruby
timvishe` has quit [Remote host closed the connection]
timvishe` has joined #ruby
nebg_ has joined #ruby
constantinexvi_ has joined #ruby
yossarian has joined #ruby
cydrobolt_ has joined #ruby
twistedpixels_ has joined #ruby
yossarian has quit [Excess Flood]
twistedpixels_ has quit [Changing host]
twistedpixels_ has joined #ruby
helpa-bot has quit [Remote host closed the connection]
SirFunk_ has joined #ruby
gsingh93- has joined #ruby
jolamb_ has joined #ruby
<Bish_>
:( sequel does some magic stuff with inheritance :(
helpa-bot has joined #ruby
tvsutton_ has joined #ruby
Radar_ has joined #ruby
hfp_ has joined #ruby
dupin has joined #ruby
<ljarvis>
you're using sequel?
antgel has quit [Read error: No route to host]
sheepman_ has joined #ruby
IcyDragon has joined #ruby
KrzaQ- has joined #ruby
Affix has joined #ruby
yossarian has joined #ruby
yossarian has quit [Excess Flood]
dupin is now known as Guest50834
Nilium_ has joined #ruby
NightMonkey_ has joined #ruby
<Bish_>
ljarvis: yes.
pwnd_nsfw` has quit [Ping timeout: 240 seconds]
<ljarvis>
that would have been a helpful mention :/
chihhsin_ has joined #ruby
Affix is now known as Guest71746
PaulePan1er has joined #ruby
timvisher has quit [*.net *.split]
Bish has quit [*.net *.split]
ichkv has quit [*.net *.split]
andikr has quit [*.net *.split]
pandaant has quit [*.net *.split]
vondruch_ has quit [*.net *.split]
ta_ has quit [*.net *.split]
DoubleMalt has quit [*.net *.split]
tdy has quit [*.net *.split]
statelesscode has quit [*.net *.split]
compass has quit [*.net *.split]
gigetoo has quit [*.net *.split]
Asher has quit [*.net *.split]
LoneHerm_ has quit [*.net *.split]
Mia has quit [*.net *.split]
AlexRussia has quit [*.net *.split]
misterpink has quit [*.net *.split]
bronson has quit [*.net *.split]
daffy_duck_2 has quit [*.net *.split]
Sauvin has quit [*.net *.split]
croberts has quit [*.net *.split]
Guest52263 has quit [*.net *.split]
GinoManWrx has quit [*.net *.split]
helpa has quit [*.net *.split]
linduxed has quit [*.net *.split]
alnewkirk has quit [*.net *.split]
sheepman has quit [*.net *.split]
Gnubie_ has quit [*.net *.split]
ericwood has quit [*.net *.split]
knight_ has quit [*.net *.split]
KrzaQ has quit [*.net *.split]
NightMonkey has quit [*.net *.split]
chihhsin has quit [*.net *.split]
tvsutton has quit [*.net *.split]
SirFunk has quit [*.net *.split]
isomorphismes has quit [*.net *.split]
scottalan has quit [*.net *.split]
clamstar has quit [*.net *.split]
fbt has quit [*.net *.split]
seggy has quit [*.net *.split]
zenspider has quit [*.net *.split]
donnoc has quit [*.net *.split]
shadeslayer has quit [*.net *.split]
olivierjanss has quit [*.net *.split]
GooseYArd has quit [*.net *.split]
pocketprotector has quit [*.net *.split]
scottschecter has quit [*.net *.split]
inukshuk has quit [*.net *.split]
ReinH_ has quit [*.net *.split]
IceDragon has quit [*.net *.split]
PaulePanter has quit [*.net *.split]
Kuukunen has quit [*.net *.split]
constantinexvi has quit [*.net *.split]
TheMoonMaster has quit [*.net *.split]
Talltree has quit [*.net *.split]
daemoen has quit [*.net *.split]
kies has quit [*.net *.split]
woodruffw has quit [*.net *.split]
gnarf has quit [*.net *.split]
ptx0 has quit [*.net *.split]
cydrobolt has quit [*.net *.split]
eam has quit [*.net *.split]
mikee has quit [*.net *.split]
wildleaf has quit [*.net *.split]
Prira has quit [*.net *.split]
Radar has quit [*.net *.split]
aurelien has quit [*.net *.split]
JiYu has quit [*.net *.split]
sonOfRa has quit [*.net *.split]
Guest87791 has quit [*.net *.split]
drbrain has quit [*.net *.split]
gsingh93 has quit [*.net *.split]
crankharder has quit [*.net *.split]
_joes_ has quit [*.net *.split]
SpX has quit [*.net *.split]
YaknotiS has quit [*.net *.split]
phantummm has quit [*.net *.split]
twistedpixels has quit [*.net *.split]
Nahra has quit [*.net *.split]
malcolmva has quit [*.net *.split]
nebg has quit [*.net *.split]
yasu___ has quit [*.net *.split]
dn` has quit [*.net *.split]
jolamb has quit [*.net *.split]
KnownSyntax has quit [*.net *.split]
Nilium has quit [*.net *.split]
hfp has quit [*.net *.split]
bairyn has quit [*.net *.split]
raldu has quit [*.net *.split]
Sp4rKy has quit [*.net *.split]
ltd has quit [*.net *.split]
sheepman_ is now known as sheepman
KrzaQ- is now known as KrzaQ
hfp_ is now known as hfp
zenspider_ has joined #ruby
Guest50834 is now known as inukshuk
statelesscode_ is now known as statelesscode
gigetoo_ is now known as gigetoo
Sp4rKy_ is now known as Sp4rKy
gsingh93- is now known as gsingh93
drbrain has joined #ruby
Nilium_ is now known as Nilium
drbrain_ is now known as drbrain
drbrain has quit [Changing host]
clamstar has joined #ruby
seggy has joined #ruby
misterpink has joined #ruby
<Bish_>
dminuoso: visible_attributes does not exist, am i supposed to create that method?
JiYu has joined #ruby
_joes_ has joined #ruby
yossarian has joined #ruby
pocketprotector has joined #ruby
donnoc_ has joined #ruby
armin_ has joined #ruby
dn` has joined #ruby
helpa-bot has quit [Remote host closed the connection]
NightMonkey_ is now known as NightMonkey
helpa has joined #ruby
eam has joined #ruby
TheMoonMaster_ has joined #ruby
<dminuoso>
Bish_: I meant visible_fields, let me cook up a proper eval.in though
u0_a92 has joined #ruby
<dminuoso>
The solution is haskish
armin has quit [Disconnected by services]
armin_ is now known as armin
olivierjanss_ is now known as olivierjanss
gnarf_ has joined #ruby
scottschecter has joined #ruby
zidane_g has quit [Ping timeout: 240 seconds]
techntoke_ has quit [Ping timeout: 240 seconds]
boxrick1 has quit [Ping timeout: 240 seconds]
Iacobus has quit [Ping timeout: 240 seconds]
rfv has quit [Ping timeout: 240 seconds]
deimos has quit [Ping timeout: 250 seconds]
ec has quit [Ping timeout: 260 seconds]
discopatrick has quit [Ping timeout: 250 seconds]
davidmichaelkarr has quit [Ping timeout: 240 seconds]
ghostlight has quit [Ping timeout: 268 seconds]
boxrick1 has joined #ruby
Iacobus has joined #ruby
zidane_g has joined #ruby
discopatrick has joined #ruby
deimos has joined #ruby
techntoke_ has joined #ruby
rfv has joined #ruby
ec has joined #ruby
davidmichaelkarr has joined #ruby
u0_a92 has quit [Client Quit]
DoubleMalt has joined #ruby
daffy_duck_2 has joined #ruby
<ljarvis>
haskish, half hackish, half haskell
YaknotiS has joined #ruby
misterpink has quit [Read error: Connection reset by peer]
kies has joined #ruby
aurelien` is now known as aurelien
phantummm has joined #ruby
Sauvin has joined #ruby
linduxed has joined #ruby
<dminuoso>
ljarvis: :)
ec has quit [Excess Flood]
aurelien has quit [Changing host]
mikee has joined #ruby
aurelien has joined #ruby
<dminuoso>
ljarvis: Where's your love for Elixir?
malcolmva has joined #ruby
AlexRussia has joined #ruby
<dminuoso>
Been a few hours already without you being amazed.
Beams has joined #ruby
ReinH_ has joined #ruby
zukin has quit [Ping timeout: 240 seconds]
<ljarvis>
I've bottled it
ec has joined #ruby
ichkv has joined #ruby
phredus has quit [Remote host closed the connection]
<dminuoso>
In order to keep inheritance chains senseful, the initial class should be a module rather.
elenatanasoiu has quit [Ping timeout: 260 seconds]
JoshS has joined #ruby
streeet25_ has joined #ruby
nanoz has quit [Read error: Connection reset by peer]
tuxaddicted has joined #ruby
jcao219 has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jeyraof has quit [Quit: This computer has gone to sleep]
ghostlight has joined #ruby
ctp has joined #ruby
pawnbox has quit [Remote host closed the connection]
craigp_ has quit [Quit: WeeChat 1.5]
craigp has joined #ruby
charliesome has joined #ruby
pawnbox has joined #ruby
workmad3 has joined #ruby
duncannz has quit [Remote host closed the connection]
jud has quit [Quit: Leaving]
zukin has joined #ruby
aupadhye has quit [Quit: Leaving]
aupadhye has joined #ruby
dANOKELOFF has joined #ruby
shadeslayer_ is now known as shadeslayer
<Bish_>
thanks alot ljarvis ,dminuoso
<Bish_>
i think i am ahppy with the solution now
<Bish_>
but i didn't take your new one with the ancestors
JeanCarloMachado has joined #ruby
<dminuoso>
Bish_: Well, my previous solution is bad because a) it gives a base class control over derived classes (which is rather horrible to be honest). Also if you reopen a Base class and modify the attributes further, the derived classes are not notified of the change.
<dminuoso>
Bish_: This solution allows each class to maintain its own state, but actively interrogates the ancestors for any visible_fields they may have.
<dminuoso>
Bish_: It's basically the same as #methods
<Bish_>
well a bit sanity is left to the developer always, doesn't it
<Bish_>
i mean you can always instance_eval on the super-class
<dminuoso>
Bish_: So when you call String.methods(false) you get the methods defined on String, but String.methods will return its methods and any of its ancestors.
<dminuoso>
I just mimic that behavior.
<dminuoso>
Bish_: It's not about intentionally breaking. It's about class invariants.
<dminuoso>
A class invariant is not meant to be indestructable.
<Bish_>
i don't understand how that destruct should happen with my current solution
<ljarvis>
yes the netsplit screwed me up a bit too
codfection has joined #ruby
<Bish_>
well yeah that one is simply, would work i guess
<Bish_>
simple*
strax has joined #ruby
da3mon has joined #ruby
<ljarvis>
simple is usually a good starting point :)
zapata has joined #ruby
<Bish_>
somehow i was scared that the instance variable will get shared between classes
lifted has quit [Quit: lifted]
<Bish_>
but if i create that in a method, it won't happen, that's true
<dminuoso>
Bish_: His solution will not satisfy the inheritance requirements you mentioned.
jahmalz has joined #ruby
<ljarvis>
what are those requirements?
<ljarvis>
I must've missed them
<Bish_>
well, i said i wanna inherit a single time
<Bish_>
and the base class is abstract
<dminuoso>
Bish_: If you have Base, Derived1 and Derived2, define attributes in Base, then define attribute in Derived1, then the attributes in Base will be changed, as well as Derived2 which derives from Base.
<Bish_>
either way, i learned alot from you two
<ljarvis>
I don't understand but ok :)
<Bish_>
either way, i think i will manage to handle it now ;) thank you!
soc42 has quit [Remote host closed the connection]
<ljarvis>
defining an attribute in Derived1 won't change anything in base, or Derived2
marr has joined #ruby
alibby has joined #ruby
fergal has joined #ruby
qwertyco has quit [Ping timeout: 268 seconds]
rodfersou has joined #ruby
Pupeno has quit [Remote host closed the connection]
Pupeno has joined #ruby
<fergal>
hi guys, i have a ruby application that accepts a bunch of flags for execution, e.g. ruby myapp.rb —optiona 1 —optionb 2 —optionc 3. i want to move away from using flags, and move towards a more subcommand type approach, e.g. ruby myapp.rb taska, ruby myapp.rb taskz etc. however, in CI, i have a ton of jobs that use the old flag method of calling my app, which i don’t want to disturb. so i want to somehow add the subcommand usage on top of the existing
<fergal>
flag usage, and have the sucbommands call the app with the appropriate flags. i’ve decided to use thor for subcommands, but i want to know, is there a way to modify ARGV so if i call my app with taska, my app will set the approprate flags by modifying ARGV and then calling the usual entry point of the app?
johnmilton has quit [Remote host closed the connection]
<apeiros>
ARGV is a plain old array. you can do with it what you want.
<dminuoso>
fergal: Before you reinvent the weel, have you looked into Rake?
<ljarvis>
yeah if you want awful argument parsing, give rake a shot
<ljarvis>
thor is pretty good
<fergal>
dminuoso: yes we use internally for creating tasks for development use mainly. i’m using thor because i want something more end user-oriented
jaruga___ is now known as jaruga
<dminuoso>
fergal: Well its certainly usable for end-user scenarios. Rails does it to a great extend. Not saying it's the solution, just wanted to toss it out there as an idea.
alexherbo2 has quit [Quit: WeeChat 1.5]
alexherbo2 has joined #ruby
<fergal>
i was just wondering what the best approach here is - my first inclination was to use thor because it has a bunch of nice little features, and i find it very straightforward to set up/maintain. the main problem, or where things get ugly, is when i want to use a subcommand to re-call my app with the appropriate flags set…so then i was thinking, maybe i shouldnt use thor at all, and use the optionparser to crowbar in subcommands, which would caue less disruption
<fergal>
my existing codebase, but i think would be a messier/hackier solution to implement
<matthewd>
Thor commands are designed to be easy-ish to invoke programatically... so you shouldn't actually need to play with ARGV directly
<ljarvis>
fergal: can you nest subcommands? or is there only 1 level?
<fergal>
ljarvis: with thor yes, you can nest subcommands
<ljarvis>
fergal: that wasn't my question :)
Guest58222 has quit [Read error: Connection reset by peer]
<ljarvis>
fergal: do *you* want to nest subcommands in your code
<ljarvis>
if you don't, often just using ARGV + option parser is nicer
alexherbo2 has quit [Client Quit]
<ljarvis>
e.g. optionparser or slop (i heard it's great)
<fergal>
ljarvis: oh, sorry, ummm right now i only need 1 level of subcommands, but thats not to say i wont need nested subcommands in the future (which is another reason i liked the idea of thor)
toretore has quit [Ping timeout: 260 seconds]
<ljarvis>
right, yeah thor seems like the best job for this then
eizua has joined #ruby
ldnunes has joined #ruby
SesMan has quit [Read error: Connection reset by peer]
RedFromage has joined #ruby
CloCkWeRX has joined #ruby
<fergal>
matthewd: the problem is invoking my app with flags, from within a thor subcommand. so say the odl way of calling my to do a task, say taskA, is: ruby myapp.rb —flag1 abc —flag2 xyz —flag3 test. i want to create a subcommand called taskA using thor, so i can just do: ruby myapp.rb taskA (which under the hood would call ruby myapp.rb —flag1 abc —flag2 xyz —flag3). at the point where my subcommand is called, ARGV looks like [“taskA”], but ideally i
<fergal>
would then want to edit ARGV to look like [“—flag1”, “abc”…], and then call the old entry point of my app (which then parses ARGV)
nuck has joined #ruby
edwinvdgraaf has joined #ruby
<matthewd>
Oh.. okay.
nuck is now known as Guest87552
<matthewd>
Well yes, you can do that by changing ARGV
<ljarvis>
or.. have default option arguments?
<fergal>
but isn’t ARGV constant?
<matthewd>
I just assumed you'd be rearranging things to be implemented via the structured thor commands, and then implementing the legacy options as a compatibility layer calling back to them
lifted has joined #ruby
qwertyco has joined #ruby
qwertyco has quit [Remote host closed the connection]
<apeiros>
fergal: constant means constantly pointing to the same object. not that the object it points to is immutable.
Jameser has joined #ruby
<ljarvis>
fergal: it's ruby, nothing is constant
<fergal>
so i can clear ARGV, then append in the values i want?
<apeiros>
s/is/should be/ (sadly not even that is enforced)
<ljarvis>
absolutely
qwertyco has joined #ruby
<ljarvis>
heh
<apeiros>
but really, have your entry point be a method which defaults to ARGV, but accepts any array.
Snowy has quit [Remote host closed the connection]
qwertyco has quit [Remote host closed the connection]
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<apeiros>
>> CONST = [1,2,3]; CONST = ["say", "whaaat?"]; CONST # warning, but not prohibited (sadly)
frankiee_ has joined #ruby
<ruby[bot]>
apeiros: # => /tmp/execpad-57f06b21b7ee/source-57f06b21b7ee:2: warning: already initialized constant CONST ...check link for more (https://eval.in/658118)
edwinvdgraaf has quit [Remote host closed the connection]
<apeiros>
(check the link, it's only a warning and the bot only shows 1 line of output)
edwinvdgraaf has joined #ruby
<ciawal>
surely that should be called replace!
<apeiros>
ciawal: and shift! and pop! and push! etc.?
<ljarvis>
:P
<ljarvis>
and delete
<ljarvis>
that one always bugged me especially
<ljarvis>
welcome to ruby, where the consistency is consistently inconsistent
<apeiros>
in my toy language it was .upcase vs. .upcased. until I noticed there's words where you can't do that distinction :(
Snowy_ has joined #ruby
<ljarvis>
yeah..
<ljarvis>
my toy language removed oop and im 200% happier
<apeiros>
pondered syntax to distinguish between "return a copy", "return modified self", "modify self but return result" etc., but never found a satisfying variant.
<apeiros>
you removed oop or you removed mutability?
<ljarvis>
i removed both
timvishe` has quit [Remote host closed the connection]
Snowy has quit [Ping timeout: 260 seconds]
ruby[bot] has quit [Remote host closed the connection]
inteq has quit []
merlin2049er has joined #ruby
<apeiros>
so you reinvented prolog?
timvishe` has joined #ruby
ruby[bot] has joined #ruby
c355e3b has joined #ruby
<ljarvis>
:D
<apeiros>
j/k of course. what flavor do you use? FP?
<ljarvis>
yep
<ljarvis>
i only have some very basic types
<ljarvis>
only modules and functions at the highest level
<ciawal>
just use elixir ;)
<ljarvis>
it's very oversimplified currently but it's working nicely
miguelfernandes has joined #ruby
<ljarvis>
ciawal: honestly that's where my changes came from
<ljarvis>
i use elixir
Snowy_ has quit [Ping timeout: 248 seconds]
<ljarvis>
it's similar in that sense, but different in others :)
nowhere_man has joined #ruby
<Bish_>
how do i change the binding of a proc?
<chrisseaton>
Bish_: change it entirely? Or just change what's in it? I think you can read and write the binding via #binding
<Bish_>
i want a proc to call methods on "self"
<Bish_>
but since the proc remembers where it's from i cannot do that
johnmilton has joined #ruby
<chrisseaton>
You want to change the value of self? I think you can do object.instance_eval(&proc) which changes self to be object
nonnatus has quit [Ping timeout: 260 seconds]
merlin2049er has quit [Quit: Leaving.]
johnmilton has quit [Read error: Connection reset by peer]
conta has quit [Ping timeout: 240 seconds]
merlin2049er has joined #ruby
<ljarvis>
pass the self to your proc?
DrCode has quit [Remote host closed the connection]
antgel has joined #ruby
<Bish_>
darn this is fucked up, what chrisseaton works, but the proc uses an instance varialbe of the original class
johnmilton has joined #ruby
<Bish_>
so i kind a want both, and don't want to do it via parameters..
<ljarvis>
why?
<chrisseaton>
I don't think there's a good way around that - method calls and instance variables obtain self in the same way - you can't change one without changing the other
<Bish_>
ljarvis: im writing my own filter syntax for user searches in sequel
<Bish_>
and want something like model.apply_my_filters("magic syntax")
<chrisseaton>
Do you control the object that you want to use as self? Can you intercept instance variable reads and writes? Not sure.
<chrisseaton>
You could certainly copy them in if it's read-only
<Bish_>
chrisseaton: no i don't, depends on what you mean by "control"
<Bish_>
i have a copy of it
tectonic has joined #ruby
synthroid has joined #ruby
shinnya has joined #ruby
tectonic has quit [Client Quit]
synthroi_ has joined #ruby
Madplatypus has quit [Quit: Connection closed for inactivity]
synthroid has quit [Ping timeout: 240 seconds]
<Bish_>
wow, now i have a proc returning a proc, and use it instance_evaled on the dataset
<Bish_>
it works.. but this is kinda ugly.
nankyokusei has joined #ruby
<sonOfRa>
When writing native extensions, are exceptions thrown immediately when they occur (for example, in a Check_Type macro), or are they only thrown once the function that I am currently in has returned?
arashb has joined #ruby
<matthewd>
sonOfRa: Immediately.
lifted_ has joined #ruby
<sonOfRa>
So, if I do a check_type, and then write C code depending on the type, that C code will not end up in weird segmentation faults?
<dminuoso>
sonOfRa: rb_raise breaks code flow by using setjmp/longjmp (which is Ruby's underlying mechanism for exceptions)
nankyokusei has quit [Ping timeout: 260 seconds]
<matthewd>
That too.. though I was pointing more to the substantial prior art of usage within core & stdlib
arashb has quit [Ping timeout: 248 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<dminuoso>
Yeah. Check_Type ends up calling rb_check_type, and I just showed you the relevant bit there.
<sonOfRa>
Ah, good. I was expecting that, but uncertain, because the only other language I've written native bindings for was java, where exceptions aren't actually raised immediately, but one has to check if they are pending during execution flow, and they are only raised when the native function returns
<sonOfRa>
Are ruby strings not internally immutable? StringValueCStr is defined to rb_string_value_cstr((), which returns char* rather than const char* (sorry if that came through twice, network problems)
Jameser has quit [Read error: Connection reset by peer]
<matthewd>
sonOfRa: Strings are not immutable.. I'd have to the check the source to confirm whether that was a deliberate/safe exposure.
Jameser has joined #ruby
tk__ has joined #ruby
juanfra_ has quit [Quit: juanfra_]
juanfra has joined #ruby
da3mon has joined #ruby
<sonOfRa>
It essentially returns whatever RSTRING_PTR spits out, minus some sanity checks whether the string is actually possible to represent as a C String
tyang has joined #ruby
<matthewd>
Specifically, I'm not sure whether it triggers a copy if the string data is shared
<dminuoso>
sonOfRa: Just be aware of which commit you are browsing under.
<dminuoso>
(Before you use the source code to assume behavior)
blackgoat has quit [Quit: WeeChat 1.5]
<sonOfRa>
Oh, right
<sonOfRa>
Doesn't look different under ruby_2_3, but thanks for the hint
brendan- has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
nullfxn has quit [Client Quit]
nullfxn has joined #ruby
jaguarmagenta has quit [Remote host closed the connection]
j3r0 has joined #ruby
sepp2k has joined #ruby
Asher1 has quit [Quit: Leaving.]
Asher has joined #ruby
nullfxn has quit [Quit: leaving]
lifted_ has joined #ruby
<matthewd>
Ah, right... if you wanted to write to it, you'd need to rb_str_modify first -- both to make it independent, and also ensure it's not frozen etc
<matthewd>
(or do other things, if you needed to change the length too)
alsvidr has joined #ruby
<sonOfRa>
I don't need to mutate them, I was just surprised they were non-const
<sonOfRa>
non-const return values sometimes (not always) mean that I'm responsible for freeing the returned data
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
craigp has quit [Ping timeout: 260 seconds]
harai_ has quit [Ping timeout: 240 seconds]
workmad3 has joined #ruby
Bish_ is now known as Bish
Suresh has joined #ruby
last_staff has quit [Quit: last_staff]
bkxd has quit [Ping timeout: 260 seconds]
lifted_ has quit [Read error: Connection reset by peer]
<Suresh>
even the i define the method words there is still raising an error
ptx0_ has quit [Quit: Changing server]
blackmesa has joined #ruby
<Suresh>
any kind soul?
Jan_ has joined #ruby
jaruga has quit [Ping timeout: 260 seconds]
<Suresh>
anyone?
Stazer has joined #ruby
ptx0 has joined #ruby
<alsvidr>
Suresh: what's your intention with the words method?
Stazer has left #ruby [#ruby]
da3mon has quit [Quit: Zzzz...]
blackmesa has quit [Ping timeout: 260 seconds]
<Suresh>
to scan each sentence into words
ptx0 has quit [Client Quit]
<alsvidr>
Suresh: IIRC, there's no such method in the standard library. You probably just want to use "split" instead of "words".
<hanmac>
Suresh: words does look like a ActiveSupport method ... which is not part of ruby
<Suresh>
hais guys the words is the method name
<Suresh>
lol
ptx0 has joined #ruby
da3mon has joined #ruby
<Suresh>
LOL
<SebastianThorn>
i dont understand the loling
<Suresh>
def words is the method name
<Suresh>
every method needs a name to it right?
<alsvidr>
It's not defined in the gist you shared
<alsvidr>
My bad, it is ...
<Suresh>
i have send 2 links
<alsvidr>
The problem is, that it is defined out of context.
<Suresh>
but i did put the words method in the Hello class you see
<alsvidr>
You have to define the words method for the class of the objects you want to use it on.
<Suresh>
meaning?
harai_ has joined #ruby
timvishe` has quit [Remote host closed the connection]
timvishe` has joined #ruby
<alsvidr>
You want to call it for objects of class String but you define it for objects of class Hello.
<alsvidr>
Meaning, it's not working because it's not defined.
<Suresh>
but it isn't it under the class Hello?
<SebastianThorn>
either you extend String with word, or add arguments the the word in your current class
tdy1 has quit [Ping timeout: 240 seconds]
<Suresh>
haha i am lost
chadwtaylor has joined #ruby
<SebastianThorn>
tho i might be wrong, because i dont really understand what the code is suppose to do
<Suresh>
basically you want to return the senetence with the desired words
<alsvidr>
Wild guess, you were exposed to Java.
<Suresh>
haha why did you say that?
nullfxn has joined #ruby
<alsvidr>
The Hello class is pretty useless and not necessary in Ruby.
<SebastianThorn>
you want to change ruby for test?
<Suresh>
ruby and test are the desired words
<Suresh>
so what you guys want me to do?
<SebastianThorn>
you want to save all strings that contain ruby or test?
<Suresh>
yeah
<SebastianThorn>
ok
<Suresh>
that's the meaning of the code
<Suresh>
basically you give an array of sentence and sort the sentences
<Suresh>
and return you the sentence sorted
childermass has joined #ruby
<matthewd>
Suresh: You're calling words on s.downcase, right?
fmcgeough has joined #ruby
<Suresh>
yeah
<Suresh>
s.words.length meaning e.g it's the sentence with: hello my name is suresh,downcase it and the total words is 4
rclsilver has joined #ruby
<matthewd>
What class is s.downcase?
Pumukel has joined #ruby
<Suresh>
s means you take whatever sentence and downcase it
<matthewd>
That is not an answer to my question
<matthewd>
Do you know what a class is?
<Suresh>
yes
<Suresh>
oh sorry
<Suresh>
it's Hello class
<matthewd>
What class is s?
<SebastianThorn>
i made a comment in your gist
JeanCarloMachado has joined #ruby
<Suresh>
string
<SebastianThorn>
should get you going
<matthewd>
And String#downcase is returning an instance of Hello class?
<rclsilver>
hello, i've some troubles with Gemfile and bundle. i want to install a gem from github. i defined this in my Gemfile (gem 'puppet-strings', :git => 'https://github.com/puppetlabs/puppet-strings.git', :branch => 'master'), i executed bundle install. i see using puppet-strings from github (branch master).. but when i execute puppet strings:generate, it doesn't found the puppet strings classes... any idea? :(
lifted has quit [Quit: lifted]
<Suresh>
thx sebas
<SebastianThorn>
np, you can do s.dowcasr.include
<SebastianThorn>
and then just make "ruby" and arg
<Suresh>
hey sebad
<Suresh>
sebas
<matthewd>
?puppet rclsilver
<ruby[bot]>
rclsilver: Please join #puppet for help with it.
<Suresh>
basically you aren't using the method tough
<Suresh>
lol
<SebastianThorn>
Suresh: should be really easy to add
<rclsilver>
already asked on puppet :s
<Suresh>
ya your answer is correct
<rclsilver>
but in my case, its a Gemfile question
sonOfRa has quit [Quit: Bye!]
<Suresh>
but you are not using the method
<matthewd>
Suresh: [23:57:09] <matthewd>And String#downcase is returning an instance of Hello class?
<Suresh>
should be right?
<matthewd>
I just checked the documentation for String#downcase on ruby-doc.org, and it didn't mention Hello at all
rodfersou is now known as rodfersou|afk
lifted has joined #ruby
sonOfRa has joined #ruby
DLSteve has joined #ruby
<chrisseaton>
matthewd: well of course not - Hello is a user defined class - how would the people writing the docs know about it?
chadwtay_ has joined #ruby
Jan_ is now known as DefV
chadwtay_ has quit [Remote host closed the connection]
<matthewd>
chrisseaton: *I* know that ;)
<alsvidr>
chrisseaton: He's trying to educate Suresh ... be quiet and watch in awe of his patience.
chadwtay_ has joined #ruby
aryaching has joined #ruby
<SebastianThorn>
now im not sure of who is trolling whom
alexherbo2 has joined #ruby
frankiee_ has joined #ruby
<Suresh>
Hello is a class name
bsrd has quit [Quit: WeeChat 1.6]
<dminuoso>
alsvidr: I think he has better things to do than to watch in awe.
Zamyatin has joined #ruby
tdy1 has joined #ruby
bsrd has joined #ruby
<Suresh>
but they are keep raising the words method not defined
<matthewd>
Suresh: What does the error say?
<Suresh>
undefined method `words' for "I like ruby":String (NoMethodError)
<dminuoso>
>> a = "foobar"; a.hello_Suresh
<ruby[bot]>
dminuoso: # => undefined method `hello_Suresh' for "foobar":String (NoMethodError) ...check link for more (https://eval.in/658179)
<dminuoso>
Suresh: ^- See that?
<matthewd>
Suresh: Does that error contain any clues about what class you're calling words on?
<matthewd>
(I'll ignore, for now, the fact that error doesn't match the code you showed)
ekinmur has joined #ruby
<Suresh>
nope
<SebastianThorn>
Suresh: is this a school-asignment you got?
z-i-g has joined #ruby
lxsameer has quit [Quit: WeeChat 1.5]
<alsvidr>
dminuoso: Was that a hint to chrisseaton to get back to work and not help noobs on IRC?
<Suresh>
i am self learning
lifted has quit [Quit: lifted]
lifted has joined #ruby
edwinvdgraaf has quit []
<SebastianThorn>
Suresh: what source are you using?
<matthewd>
Suresh: There's nothing in that message that looks like a class?
<Suresh>
i am using peter cooper beginning ruby
<Suresh>
sorry guys i am new to ruby
gnufied has joined #ruby
gnufied has quit [Max SendQ exceeded]
craigp has joined #ruby
edwinvdgraaf has joined #ruby
<Suresh>
but i got an question
<matthewd>
Suresh: Okay, let's try it this way: there is, in fact, something in the error that tells you what class you called the method on. Can you find it?
<SebastianThorn>
is there a commad or some for why's guide or the other guides?
<Suresh>
String right?
<matthewd>
Right indeed
bsrd has quit [Quit: WeeChat 1.6]
<Suresh>
so why does the String class is raising an issue?
<matthewd>
Because it doesn't have a words method
gnufied has joined #ruby
jaguarmagenta has joined #ruby
saslam has joined #ruby
<SebastianThorn>
Suresh: get started on ruby here: http://tryruby.org/ not sure how long it is
<Suresh>
it's like very weird becoz there is a method called words and the string class is raising an issue
<fergal>
guys in java, i can define a classfull of static methods, and then sattically import these methods into other classes and call them as if they were defined within that class, i.e. i don’t need to call them using the package name. is it possible in ruby to create a class with static methods, e.g. a helper class with file IO helpers, and import these methods into a class, so that i can call the methods without having to specify the module name?
<matthewd>
Suresh: Do you have experience in any programming language?
<SebastianThorn>
Suresh: you are not calling the method you wrote, you are calling a method for string, that does not exist
<Suresh>
yes i do java
saslam_ has joined #ruby
Toledo has joined #ruby
<Suresh>
ok i understand
patarr has joined #ruby
<SebastianThorn>
start with the guides i linked
sonOfRa has quit [Quit: Bye!]
<Suresh>
ok so how do i expect a Hello object rather than a String object?
malconis has joined #ruby
<matthewd>
You don't. How would you write this in Java?
<SebastianThorn>
i dont wanna be an asshole here, but are you going to open the links i sent you and look at them?
jaguarmagenta has quit [Remote host closed the connection]
Wayne_Shephard has quit [Read error: Connection reset by peer]
saslam has quit [Ping timeout: 250 seconds]
<Suresh>
kk thanks
<matthewd>
SebastianThorn: Are they inherently better than Peter Cooper's book? :/
sonOfRa has joined #ruby
<SebastianThorn>
i dont know Peter Cooper, but why's has comics in them :)
<SebastianThorn>
matthewd: ^
sonOfRa has quit [Client Quit]
ChiefAlexander has joined #ruby
<SebastianThorn>
matthewd: you rad Coopers? is it good?
<Suresh>
yes it is good
sonOfRa has joined #ruby
<Suresh>
how do guys became very good at ruby?
johnmccabe has joined #ruby
<dminuoso>
Suresh: I never did.
<SebastianThorn>
im not verry good, i just get by with what i know, and know where to search for what i need to learn
threh has joined #ruby
<ljarvis>
irc? :D
<Suresh>
oh i see
<dminuoso>
Im just the bad mannered guy in here, pointing out without manners how some are even worse than myself.
<Suresh>
anyway thx for helping :)
al2o3-cr has quit [Ping timeout: 260 seconds]
<matthewd>
SebastianThorn: No I haven't, I was just confused because the solution you were insisting upon for "I'm working through this introductory material, and am [clearly] confused" was "read these other two full-length tutorials"
saslam_ has quit [Read error: Connection reset by peer]
ChiefAlexander_ has joined #ruby
fhw3 has joined #ruby
timvishe` has quit [Remote host closed the connection]
timvishe` has joined #ruby
ChiefAlexander has quit [Ping timeout: 260 seconds]
<fhw3>
@help
lifted has quit [Ping timeout: 260 seconds]
<SebastianThorn>
matthewd: ahh, ok, might not have been the best thing to do
<kyle__>
ljarvis: It's been a while since I dug into it.... is there a good article that explains the difference between a lambda and block then? You yeild to both right?
<kyle__>
Sometimes wandering into this channel forces me to go read stuff.
ichkv has quit [Remote host closed the connection]
<chrisseaton>
kyle__: I can't think of an article, but the major difference at the front of my mind is that lambdas expect a correct number of arguments, where as procs and blocks (which are the same thing) take any old arguments and sometimes do strange things with them.
<dyjakan>
even more important is the return point of both
<kyle__>
chrisseaton: Ahh ok. So it's mostly a matter of strictness?
<dyjakan>
# of args is just cherry on top
childermass has joined #ruby
<chrisseaton>
dyjakan kyle__: yes there's also some differences in how they handle break and retry and things - it gets quite subtle
Derperperd has joined #ruby
<chrisseaton>
A lambda is more like a proper method - if you return from it you return from the lambda. A proc is like a fragment of a method - if you return from it you return from the method that contains it.
newbie22 has quit [Read error: Connection reset by peer]
newbie22 has joined #ruby
pawnbox has joined #ruby
coolboy has joined #ruby
coolboy has quit [Remote host closed the connection]
dminuoso has quit [Ping timeout: 260 seconds]
patarr has joined #ruby
<Bish>
ljarvis: have you given up on me :D
tyang has quit [Ping timeout: 248 seconds]
troulouliou_div2 has quit [*.net *.split]
tekk has quit [*.net *.split]
bokayio has quit [*.net *.split]
tekk has joined #ruby
pawnbox has quit [Ping timeout: 240 seconds]
wldcordeiro has quit [Ping timeout: 240 seconds]
qwertyco has quit [Ping timeout: 260 seconds]
fergal has quit [Ping timeout: 260 seconds]
fergal has joined #ruby
timvishe` has quit [Remote host closed the connection]
vondruch_ has joined #ruby
timvishe` has joined #ruby
nonnatus has joined #ruby
houhoulis has quit [Remote host closed the connection]
jzigmund has quit [Quit: leaving]
vondruch has quit [Ping timeout: 260 seconds]
DoubleMalt has quit [Remote host closed the connection]
<Bish>
ljarvis: i can provide the block via &->(){}
<Bish>
that makes the resulting proc being able to return
<Bish>
but that makes it less pretty
jzigmund has joined #ruby
banisterfiend has joined #ruby
tk__ has quit [Quit: ばいばい]
dminuoso has joined #ruby
misterpink has joined #ruby
<Bish>
wonder how define_method does that, but i guess that's c-foo
Stazer has joined #ruby
rippa has joined #ruby
aganov has quit [Quit: Leaving]
<dminuoso>
asm>> def f; end
<ruby[bot]>
dminuoso: I have disassembled your code, the result is at https://eval.in/658209
zapata has quit [Quit: WeeChat 1.6]
polishdub has joined #ruby
<Bish>
will ruby 3 with jit be awesome?
blackmesa has quit [Ping timeout: 240 seconds]
<chrisseaton>
Bish: I think to make a JIT work in MRI they're going to need to resolve some serious open research questions about optimising through compiled C runtime code
<timmyBsd>
anybody an idea whats wrong here ((Float::MAX - (2<<968)) == Float::MAX #=> true, and (Float::MAX - (2<<969)) == Float::MAX #=> false)
<dminuoso>
chrisseaton: Talking about JIT, how's that "secret" project of yours going on?
<chrisseaton>
dminuoso: was it you I promised to show that to? I forgot who wanted to see it
<Suresh>
anyone got read peter cooper book?
<dminuoso>
chrisseaton: Yeah.
<chrisseaton>
I will DM you
<dminuoso>
Very well.
<Bish>
what is dm?
<Bish>
heard that several times now
<chrisseaton>
direct message - private message room
<Bish>
im getting old
<Bish>
oh.
<Bish>
i thought it was some weird twitter thing.
<SebastianThorn>
i thought you were getting banned DeMonized
zapata has joined #ruby
<Bish>
why would getting banned? im a nice person
tenderlove has quit [Read error: Connection reset by peer]
<Bish>
why would i get banned*
conta has quit [Ping timeout: 240 seconds]
lifted has joined #ruby
<chrisseaton>
timmyBsd: when you add something to a float, the thing that is added is converted to a float, and in this case the float doesn't have the precision to represent the larger number accurately, I think, without doing the maths to be sure
<chrisseaton>
timmyBsd: so the number is slightly off, and doesn't match what you'd expect
<ruby[bot]>
Bish: I have disassembled your code, the result is at https://eval.in/658213
tenderlove has joined #ruby
tenderlove has joined #ruby
tenderlove has quit [Changing host]
brendan- has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<Bish>
doing that is stupid, right?
<dminuoso>
Bish: With raw string maybe, but especially interpolating regular expressions with the //x modifier can be really useful.
<Bish>
what does the x modifier doß
<Bish>
maybe i should read that, instead of asking
nikivi has joined #ruby
ichkv has quit [Remote host closed the connection]
LDFJIO has quit [Read error: Connection reset by peer]
vondruch_ is now known as vondruch
newbie22 has quit [Read error: Connection reset by peer]
Sonicblaze has joined #ruby
LDFJIO has joined #ruby
nikivi has quit [Read error: Connection reset by peer]
ldnunes has quit [Quit: Leaving]
LDFJIO is now known as Snowy
pagios has joined #ruby
<pagios>
caan ruby scripts replace bash scripting? like can i use ruby to accomplish tasks that are done usually in bash scripting? any limitations using ruby? thanks
johnmccabe has joined #ruby
Pupeno has quit [Remote host closed the connection]
<SebastianThorn>
pagios: tasks like?
<pagios>
like pipiing data into bash, using the data inash to exe commands, send to send awk etc
K7 has joined #ruby
dminuoso has quit [Remote host closed the connection]
nonnatus has quit [Ping timeout: 248 seconds]
ichkv has joined #ruby
pawnbox has joined #ruby
Suresh has quit [Ping timeout: 260 seconds]
nikivi has joined #ruby
pawnbox has quit [Ping timeout: 250 seconds]
chouhoulis has joined #ruby
nettoweb has quit [Ping timeout: 240 seconds]
nettoweb has joined #ruby
pawnbox has joined #ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
Pupeno has joined #ruby
Pupeno has quit [Read error: Connection reset by peer]
Pupeno has joined #ruby
patarr has quit [Quit: patarr]
DrCode has quit [Ping timeout: 248 seconds]
pawnbox has quit [Remote host closed the connection]
Stazer has left #ruby [#ruby]
pawnbox has joined #ruby
fnord___ has joined #ruby
tyang has joined #ruby
ichkv has quit [Remote host closed the connection]
Pupeno has quit [Read error: Connection reset by peer]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
Pupeno has joined #ruby
Pupeno has quit [Changing host]
Pupeno has joined #ruby
timvishe` has quit [Remote host closed the connection]
timvishe` has joined #ruby
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sumobob has joined #ruby
Oclairi has joined #ruby
DrCode has joined #ruby
j3r0 has joined #ruby
nikivi has quit [Read error: Connection reset by peer]
chouhoulis has quit [Remote host closed the connection]
daffy_duck_2 is now known as mama_vadzima
Oclair has quit [Ping timeout: 240 seconds]
aryaching has quit [Ping timeout: 248 seconds]
zipace has joined #ruby
aufi has joined #ruby
mama_vadzima is now known as felix_the_cat
houhoulis has joined #ruby
benlieb has joined #ruby
nikivi has joined #ruby
Jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jaruga has quit [Quit: jaruga]
DoubleMalt has joined #ruby
aryaching has joined #ruby
calmchaos has joined #ruby
nikivi has quit [Read error: Connection reset by peer]
skweek has joined #ruby
ichkv has joined #ruby
wugy has quit []
yardenbar has quit [Ping timeout: 248 seconds]
dviola has joined #ruby
grh has joined #ruby
elhu has joined #ruby
jaruga___ has joined #ruby
jaruga___ is now known as jaruga
anaiden has joined #ruby
jaguarmagenta has joined #ruby
rippa has quit [Ping timeout: 248 seconds]
sumobob has quit [Ping timeout: 260 seconds]
patarr has joined #ruby
amclain has joined #ruby
childermass has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
[Butch] has joined #ruby
<manveru>
pagios: the only limitation i know of is that you can't set env variables that are then available after ruby exitss
<manveru>
*exits
jaguarmagenta has quit [Ping timeout: 260 seconds]
<manveru>
people have written whole terminals and shells in ruby
<Papierkorb>
pagios: You can build the pipe manually if you want to, or you can resort to `` or system(). There's also the lesser known (and badly documented) gem "shell" in the standard distribution you might want to look at
<TomyWork>
I'm starting a new project which accesses a soap api and then displays information from it. Potentially there are callbacks (I don't have the slightest idea about how soap works right now) which soap library do you suggest to use?
<TomyWork>
i mean apart from not using soap at all :)
<manveru>
i think savon wasn't terrible
jaruga has quit [Quit: jaruga]
<Papierkorb>
pagios: Though I don't know why you would want to *replace* bash scripting. They have their place, and for many things, are perfectly fine (as in: Ruby would serve no benefit over plain bash)
<pagios>
Papierkorb, i prefer having ruby do it all
claudiuinberlin has quit []
<pagios>
so i learn 1 programming lan
jsrn_ has quit [Read error: Connection reset by peer]
Silthias has joined #ruby
<Papierkorb>
pagios: But you use a shell anyway to get anywhere efficiently
<manveru>
where's shevy when you need him
maucar has joined #ruby
maucar has quit [Remote host closed the connection]
<pagios>
Papierkorb, i use a bash shell but not bash scripting
SesMan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maucar has joined #ruby
<Papierkorb>
Bash scripting is really just what you would do, or could do, in an interactive shell. Knowing that actually speeds up shell based workflows quite a lot, so I'd recommend learning bash more. (Or another shell if you prefer that)
<pagios>
the sytanx and such.. tying to reduce as much as possible memorizing stuff that can i be done in 1 proaggming language instead of doing in many
<elomatreb>
fish (https://fishshell.com/) is really nice and doesn't have as much weird legacy stuff as bash or zsh
<Papierkorb>
But it's also not POSIX compliant
Talltree_ is now known as Talltree
<pagios>
POSIX?
Silthias1 has quit [Ping timeout: 260 seconds]
synthroi_ has quit [Remote host closed the connection]
<elomatreb>
Papierkorb: Neither are bash nor zsh, if not run in a certain mode, right?
<Papierkorb>
elomatreb: still nearer to the original
blackmesa has joined #ruby
<elomatreb>
Anyway, I have yet to think "Well, I sure need POSIX compliance now!"
<manveru>
well, if you want that, you can always run them with a specific shell
szymon has quit [Quit: Leaving]
<elomatreb>
^ this
<manveru>
fish is pretty nice for starting out
<pagios>
Papierkorb, so idea is instead of learning the bash syntax for loops, conditions, the way threading works etc.. i can do all in ruby
<pagios>
why not
<elomatreb>
I actually started with zsh, but I recently switched
nankyokusei has quit [Ping timeout: 260 seconds]
szymon has joined #ruby
SeepingN has joined #ruby
<Papierkorb>
pagios: Bash, or if you're unlucky sh, scripts run everywhere, without any additional software involved. Huge plus to me.
<elomatreb>
pagios: It depends on what you want to do. Shells were built to do a specific thing, bending Ruby to do those is usually painful
<Papierkorb>
pagios: And knowing some things will also speed up your interactive shell usage too, so you actually save time
<manveru>
pagios: so ruby is your first programming language?
timvishe` has quit [Remote host closed the connection]
lucast has quit [Ping timeout: 260 seconds]
timvishe` has joined #ruby
Couch has quit [Ping timeout: 244 seconds]
<manveru>
i mean, i started out with ruby trying to do the exact same thing you want to do :)
<manveru>
even wrote my own shell in ruby
<pagios>
yes
craigp_ has joined #ruby
lucast has joined #ruby
f0rpaxe has joined #ruby
CloCkWeRX has left #ruby [#ruby]
<manveru>
just stick with it then until you're comfortable
nitric has joined #ruby
magellanicloud has joined #ruby
<manveru>
you'll eventually either realize why people say you should learn bash, or you'll never need it :)
<TomyWork>
elomatreb "Finally, a command line shell for the 90s"
<elomatreb>
;)
<TomyWork>
i'm going to have to try that next year, in 1999
<elomatreb>
It's referencing how the traditional shells (based on csh) were relatively unchanged since the early 80s
<TomyWork>
ah boo, no windows download
<seitensei>
ruby was my first
<seitensei>
almost a decade ago, haha
<TomyWork>
i just thought "this has a web interface, i'm gonna give this to my colleagues"
<TomyWork>
dyjakan oh you used a tab instead of spaces there. now how do i explain that...
<dyjakan>
but that's exactly why it's not the best 1st choice
alsvidr has quit [Quit: Connection closed for inactivity]
<TomyWork>
really, not a good first language
<elomatreb>
flying: You could do `p @root_user` in the line above that to print it
<flying>
ok I 'll do thanks :) but how can I know where is declared?
<dyjakan>
identation is minor obstacle
<dyjakan>
and overall python code is basically pseudo code that runs
<dyjakan>
not so much with ruby, where there is magic
<dyjakan>
it's not that you can't go past that but it requires more rigor
<dyjakan>
hence higher level of drop outs
<elomatreb>
flying: Instance variables in Ruby are not declared like in other languages, it's set somewhere. You could search for "@root_user = " in your codebase
<Papierkorb>
All languages, which are indention based, are too hard to read to me. You can't quickly skim code (no real visual cues where a body ends), and while I don't buy that "oh a tab" argument accidental indention can cause whacky problems
<elomatreb>
dyjakan: I found the opposite true. Ruby syntax is more free, which makes entry for complete beginners easier
<Papierkorb>
And if a file becomes much longer than the screen it is read on, indention will make it completely unreadable
<TomyWork>
Papierkorb you haven't seen to code my colleagues write :)
<dyjakan>
elomatreb: with freedom comes responsibility
<TomyWork>
in basically all languages except for java, where we have strict code style
<dyjakan>
and we're talking about newbies
anaiden has quit [Quit: anaiden]
jackjackdripper has joined #ruby
<dyjakan>
python is much better for 'getting programming' without much fuss of underlying language
<Papierkorb>
dyjakan: Newbies are just that: New. They'll learn. So lets make them learn something useful
<Papierkorb>
dyjakan: Don't read that as "python isn't useful"
<dyjakan>
if talking about useful then again python is better and order of magnitude
tomphp has quit [Ping timeout: 260 seconds]
<elomatreb>
dyjakan: There are also other things that I think make Ruby a decent choice for beginners. The Ruby standard library is hands down the best I've ever used
<TomyWork>
dyjakan whitespace sensitivity is fuss
<elomatreb>
Passing self is fuss
<DLSteve>
My first language was Objective-C... been smooth sailing since then.
<TomyWork>
they'll have enough trouble with the syntax they see
<dyjakan>
Ruby is used mostly for webdev
<TomyWork>
let alone the syntax they dont see
<dyjakan>
python is anything scientific, technical, engineering, itsec, etc
<havenwood>
dyjakan: Maybe by a plurality, but Ruby is popular for many things.
<dyjakan>
and on top of that webdev ;)
<elomatreb>
My first language was a weird robotics dialect of ARM C :<
<havenwood>
dyjakan: If you think Ruby is only for webdev you're mistaken.
<dyjakan>
don't put words into my mouth
<DLSteve>
dyjakan, I'm backwards I use Python for web dev and ruby for automation :P
<dyjakan>
I said _mostly_
<dyjakan>
and you can't argue against
<dyjakan>
majority of people came into ruby from Rails
magellanicloud has quit [Quit: Leaving]
<dyjakan>
one could argue that if not rails then ruby would still be a niche
Eiam has joined #ruby
<TomyWork>
i came to ruby despite rails
<DLSteve>
I mainly use it for Chef/Puppet.
<dyjakan>
I really like ruby but I like facts and truth more
<elomatreb>
Also things like Metasploit, Chef, ...
<havenwood>
dyjakan: A nice thing about a multi-paradigm, many ways to do it language is that it'll give you growing room and bring more general familiarity to bring forward.
<dyjakan>
metasploit is a drop in the ocean for itsec
<raldu_>
I became interested in ruby because of first port of Metasploit from Perl to Ruby
<dyjakan>
which is my original background so I know a thing or two
<havenwood>
dyjakan: We can argue with "mostly," especially if by that you mean more than half?
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
magellanicloud has joined #ruby
<raldu_>
as a hobbyist I am quite happy with expressiveness and friendly interface of Ruby and can get quite a lot done.
<dyjakan>
yes, I would say 75% ruby devs are really rails/sinatra/web devs
zirpu has left #ruby [#ruby]
krandi has quit [Remote host closed the connection]
<dyjakan>
tbh I know only 2 people online and 1 irl that use ruby outside of webdev space
<TomyWork>
bias, then? :)
patarr has quit [Quit: patarr]
<dyjakan>
no, because I know many more that use Ruby in webdev
<dyjakan>
and that's my point
<havenwood>
dyjakan: Maybe you just know a bunch of Ruby webdevs? I don't know why you don't know more Rubyists working on other things but there sure are lots of them.
j3r0 has quit [Ping timeout: 260 seconds]
edwinvdgraaf has quit [Remote host closed the connection]
anaiden has joined #ruby
<dyjakan>
ok this discussion is really pointless, my 5c is this: first language? python is much better choice; you're free to disagree
<dyjakan>
btw I work as ruby dev, just for clarification ;)
edwinvdgraaf has joined #ruby
mikecmpbll has quit [Ping timeout: 260 seconds]
vuoto has joined #ruby
<havenwood>
dyjakan: Kinda like saying green is a better color to start painting with than red. Either is fine.
GambitK has joined #ruby
<apeiros>
havenwood: you clearly have absolutely NO idea of colors!
<dyjakan>
havenwood: not my problem it's same for you
tlaxkit has quit [Quit: tlaxkit]
<havenwood>
dyjakan: I don't think one is particularly better than the other for beginners.
elhu has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elifoster has joined #ruby
<TomyWork>
elomatreb oh i was wrong, there is fish for cygwin
<elomatreb>
TomyWork: Shouldn't it also work with the new linux subsystem? I know zsh works
mikecmpbll has joined #ruby
edwinvdgraaf has quit [Ping timeout: 260 seconds]
<GambitK>
hello, sorry for the newb question, I've been looking for the answer searching google but I can't find what does the "=>" operator do? as in "@myvar => {}"
<flying>
but I can't search any root_user declaration in that code... how can I search where are declared?
<matthewd>
GambitK: That's a rather unusual pair of values... but => separates a single key/value pair in a hash.
<havenwood>
GambitK: It's called a "Hash rocket." You'll see them inside of Hash literals, especially when the key isn't a Symbol.
<acovrig>
I have a MySQL DB with data, and a ruby script that processes some data from said DB, I’d like to insert the processed data into a postgres DB, the script currently uses activerecord, is it possible to have multiple activerecord connections? or should I process the data into memeory (like a giant array) then redefine activrecord to my postgres DB and do all the inserts there?
ruby-lang893 has quit [Ping timeout: 260 seconds]
Snowy has quit [Ping timeout: 260 seconds]
elenatanasoiu has quit [Ping timeout: 268 seconds]
<manveru>
acovrig: you could use sequel :)
<matthewd>
acovrig: Yes it's possible to have multiple AR connections (most easily, by using different models for each).. but if you have a lot of data, you might be better off with a lower level bulk process
gizmore has quit [Ping timeout: 260 seconds]
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gizless has joined #ruby
<acovrig>
manveru: I’ve heard of sequel, and will look into it
<acovrig>
matthewd: they share a common table name, so I doubt I could do that directly, and IDK what ‘a lot of data’ would be, it’s a lot to me: 200MB SQL export from mysqldump
<matthewd>
acovrig: self.table_name = 'x'
ramfjord has quit [Ping timeout: 260 seconds]
<acovrig>
matthewd: ah, that makes sense lol
<acovrig>
manveru: for some reason I guess I thought this only worked with sqlite, it looks handy
wldcordeiro has joined #ruby
<manveru>
it's probably my favorite ruby lib of all times
<manveru>
apart from bacon of course
mtkd has quit [Ping timeout: 248 seconds]
dwradcliffe has joined #ruby
ta_ has joined #ruby
osvimer has joined #ruby
rcvalle has joined #ruby
<bougyman>
<3 bacon
maucar has quit [Quit: Leaving]
mtkd has joined #ruby
blaxter has quit [Quit: foo]
osvimer has quit [Client Quit]
sandelius has joined #ruby
dwradcliffe has quit [Client Quit]
timvishe` has quit [Remote host closed the connection]
Silthias1 has quit [Quit: Leaving.]
* acovrig
hasn’t heard of the bacon gem, “a small RSpec clone”?
timvishe` has joined #ruby
BTRE has quit [Ping timeout: 260 seconds]
vondruch has quit [Changing host]
vondruch has joined #ruby
jzigmund has quit [Changing host]
jzigmund has joined #ruby
Sonicblaze has quit [Changing host]
Sonicblaze has joined #ruby
K7 has quit [Changing host]
K7 has joined #ruby
f0rpaxe has quit [Changing host]
f0rpaxe has joined #ruby
GambitK has quit [Changing host]
GambitK has joined #ruby
Wizznt has quit [Changing host]
Wizznt has joined #ruby
ramfjord has joined #ruby
blandflakes has joined #ruby
_djbkd has joined #ruby
blandflakes has quit [Changing host]
blandflakes has joined #ruby
da3mon has quit [Quit: Zzzz...]
async_prince has joined #ruby
elhu has joined #ruby
chadwtay_ has quit [Remote host closed the connection]
async_prince has quit [Client Quit]
chadwtay_ has joined #ruby
calmchaos has quit [Quit: Leaving...]
troulouliou_div2 has quit [Remote host closed the connection]
<manveru>
i think the goal was to make rspec in 300 LoC
<manveru>
these days it's a few more lines, but hasn't really changed in ages
<ljarvis>
<3 bacon
jahmalz has quit [Ping timeout: 250 seconds]
elhu has quit [Read error: Connection reset by peer]
DoubleMalt has quit [Ping timeout: 248 seconds]
blackmesa has quit [Ping timeout: 240 seconds]
mark_661 has quit [Remote host closed the connection]
tyang has quit [Ping timeout: 248 seconds]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TomyWork has quit [Ping timeout: 256 seconds]
Snowy has joined #ruby
<harfangk>
man
<harfangk>
now i'm craving for good bacon...
thisiskevin has joined #ruby
rakm has joined #ruby
fnux has joined #ruby
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
edwinvdgraaf has joined #ruby
last_staff has joined #ruby
jaequery has joined #ruby
NTrash has quit [Quit: Konversation terminated!]
IcyDragon is now known as IceDragon
JeanCarloMachado has quit [Ping timeout: 268 seconds]
IceDragon is now known as Guest73204
elifoster has quit [Ping timeout: 250 seconds]
ta_ has quit [Remote host closed the connection]
threh has quit [Ping timeout: 260 seconds]
z-i-g has quit [Quit: Leaving]
<GambitK>
i have a hash inside another hash, is there a way to get the child hash inside the parent?
Pumukel has joined #ruby
<GambitK>
as in the key,value pairs are moved to the parent hash
Guest73204 is now known as IceDragon
<baweaver>
What have you tried?
tomphp has joined #ruby
da3mon has joined #ruby
<thisiskevin>
GambitK: what is your use case?
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has quit [Client Quit]
synthroid has joined #ruby
maikowblue has joined #ruby
jcao219 has quit [Ping timeout: 260 seconds]
nettoweb has joined #ruby
elifoster has joined #ruby
<GambitK>
i'm modifying some code to make a decision, the data is added to a hash as a new hash and I want to give it the option of adding the values directly to the original hash or as it is now.
<thisiskevin>
GambitK: what are you doing exactly?
<manveru>
that's of course if you want to be fully destructive, and you don't want to keep the child after merging :)
<GambitK>
parent is a hash, and parent[@child] is another hash populated by parsing some data(this is not my code)
<GambitK>
yes, i want to remove the child
Derperperd has quit [Quit: Derperperd]
<harfangk>
remember that if there's a duplicate key, the hash passes as argument will take priority
bsrd has quit [Quit: WeeChat 1.6]
bsrd has joined #ruby
bsrd has quit [Client Quit]
acovrig has quit [Quit: acovrig]
Torkable has joined #ruby
al2o3-cr has joined #ruby
patarr has quit [Quit: patarr]
nettoweb has joined #ruby
Dimik has joined #ruby
lxsameer has joined #ruby
skweek has quit [Ping timeout: 240 seconds]
threh has joined #ruby
Zamyatin has quit [Quit: Knocking out. Peace y'all...]
cpruitt has joined #ruby
j3r0 has joined #ruby
Sauvin has quit [Read error: Connection reset by peer]
blackmesa has joined #ruby
Pumukel has quit [Remote host closed the connection]
ta_ has joined #ruby
JoshS has quit [Quit: Leaving]
yuung has joined #ruby
Jackneill has joined #ruby
yuung has left #ruby [#ruby]
yuung has joined #ruby
<yuung>
how can i catch an exception from Open3::popen3? i'd like it to say, "if the process under popen3 throws an exception, catch the exception & return that process' exit status"
<yuung>
s/say/function as
<ytti>
begin
timvishe` has quit [Remote host closed the connection]
<lucasb>
now, how to get an array of the keys which has value 1 ?
whathappens has joined #ruby
<matthewd>
ary.group_by(&:itself).select {|_,a| a.size == 1 }.map(&:last).... or [Object.new, *ary.sort, Object.new].each_cons(3).select {|a,b,c| a != b && b != c }.map {|_,b,_| b }
<lucasb>
and sorry, I didn't mean to evaluate here in the bot
timvisher has joined #ruby
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jgt has quit [Ping timeout: 250 seconds]
<matthewd>
lucasb: That only allocates one object.. you're not rubying right ;)
<Papierkorb>
matthewd: Is the array optimized away?
tomphp has joined #ruby
<Papierkorb>
Or do you mean it's only allocated once?
conta has quit [Ping timeout: 240 seconds]
<matthewd>
Papierkorb: I meant lucasb's solution. Both of mine go alloc-crazy. GC's gotta earn its keep.
<Papierkorb>
ah yes I referred to lucasb' line too
tomphp has quit [Client Quit]
whathappens has quit [Remote host closed the connection]
whathappens has joined #ruby
timvisher has quit [Remote host closed the connection]
timvishe` has quit [Remote host closed the connection]
timvishe` has joined #ruby
tomphp has joined #ruby
<matthewd>
Ah, okay. I was counting the hash, but not the array because that's the input of the function. The line as presented allocates two objects.
_djbkd has quit [Remote host closed the connection]
<yuung>
if an exception is thrown in Sidekiq::Worker#perform, does sidekiq automatically retry the job or do I have to handle the exception?
Ishido has quit [Quit: Roads? Where We're Going We Don't Need Roads.]
djellemah has quit [Ping timeout: 248 seconds]
lel has joined #ruby
_djbkd has joined #ruby
JeanCarloMachado has quit [Ping timeout: 250 seconds]
timvishe` has quit [Remote host closed the connection]
timvishe` has joined #ruby
modin has quit [Ping timeout: 258 seconds]
whathappens has quit [Remote host closed the connection]
bkxd_ has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Chelsea has quit [Ping timeout: 250 seconds]
thisiskevin has quit [Quit: Page closed]
bkxd has quit [Ping timeout: 240 seconds]
modin has joined #ruby
acovrig has joined #ruby
whathappens has joined #ruby
GinoMan2440Wrx has quit [Quit: Leaving]
<acovrig>
I have data I’m trying to import to a DB with Sequel, I’m trying DB[:table_name].import([:name], %w(val1 val2 val3)) to fill the name column with val1-3 for table_name; I’m getting PG::NotNullViolation because created_at is being inserted as null instead of CURRENT_TIMESTAMP; how do I fix this?
j3r0 has quit [Ping timeout: 260 seconds]
johnmccabe has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bsrd has joined #ruby
bkxd_ has quit [Ping timeout: 268 seconds]
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yqt has joined #ruby
agent_white has quit [Quit: leaving]
johnmccabe has joined #ruby
elastix has quit [Quit: Leaving]
twalla has joined #ruby
lxsameer has quit [Quit: WeeChat 1.5]
merlin2049er has quit [Quit: Leaving.]
YaknotiS has quit [Quit: Leaving]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
merlin2049er has joined #ruby
timvishe` has quit [Remote host closed the connection]
timvishe` has joined #ruby
JoshL has quit [Ping timeout: 248 seconds]
YaknotiS has joined #ruby
elifoster has quit [Quit: class]
Pupeno has joined #ruby
benlieb has joined #ruby
twalla has quit [Ping timeout: 260 seconds]
SCHAAP137 has quit [Quit: Leaving]
blackmesa has quit [Ping timeout: 260 seconds]
mikeiniowa has quit [Remote host closed the connection]
mikeiniowa has joined #ruby
Pupeno has quit [Ping timeout: 260 seconds]
nanoz has quit [Read error: Connection reset by peer]
brendan- has joined #ruby
SCHAAP137 has joined #ruby
elenatanasoiu has joined #ruby
symm- has quit [Quit: Leaving...]
patarr has quit [Quit: patarr]
grh has quit [Ping timeout: 260 seconds]
biberu has quit []
Radar_ is now known as Radar
Radar has quit [Changing host]
Radar has joined #ruby
charliesome has joined #ruby
abe has quit [Ping timeout: 268 seconds]
Felipe__ has joined #ruby
elenatanasoiu has quit [Ping timeout: 250 seconds]
NTrash has joined #ruby
symm- has joined #ruby
nettoweb has joined #ruby
Madplatypus has joined #ruby
<NTrash>
test
NTrash has quit [Client Quit]
NTrash has joined #ruby
brendan- has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
timvishe` has quit [Remote host closed the connection]
fmcgeough has quit [Quit: fmcgeough]
timvishe` has joined #ruby
elenatanasoiu has joined #ruby
ledestin has joined #ruby
Jackneill has quit [Remote host closed the connection]
maddmaxx has quit [Quit: Going offline, see ya! (www.adiirc.com)]
RTFM[away] has quit [Ping timeout: 260 seconds]
rodfersou has quit [Quit: leaving]
jaguarmagenta has joined #ruby
ekinmur has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elenatanasoiu has quit [Ping timeout: 260 seconds]
jaguarmagenta has quit [Ping timeout: 260 seconds]
yqt has quit [Ping timeout: 268 seconds]
acovrig has quit [Quit: acovrig]
agit0 has joined #ruby
Lyubo1 has quit [Ping timeout: 268 seconds]
cpruitt has quit [Quit: cpruitt]
jenrzzz_ has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
nonnatus has joined #ruby
jackjackdripper has joined #ruby
patarr has joined #ruby
johnmccabe has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch34 has joined #ruby
ChiefAlexander has quit [Quit: Leaving...]
jenrzzz has quit [Ping timeout: 260 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Bob8989|2 has joined #ruby
SteenJobs has joined #ruby
timvishe` has quit [Remote host closed the connection]
Oclairi is now known as Oclair
timvishe` has joined #ruby
<chrisseaton>
NTrash: hello
da3mon has quit [Quit: cya...]
stemid has joined #ruby
<stemid>
I'm a total newbie but I installed rvm and made it use my system ruby 2.3.1 installed by fedora 24. and then I did gem install fpm but ran into this exact error https://github.com/bundler/bundler/issues/3821 (but without bundler) I see other packages besides bundler having this issue. is there a workaround?
patarr has quit [Ping timeout: 248 seconds]
Chelsea has joined #ruby
Pupeno has joined #ruby
<stemid>
was hoping to use rvm the way I'd normally use virtualenv but I'm not at all experienced with ruby.
whathappens has quit [Remote host closed the connection]
AlexxNica has quit [Quit: AlexxNica]
<chrisseaton>
stemid: can you gist the complete set of commands you run and the errors you see?