<siery>
ow.. thats becouse it is false or true.. that makes sens. Thank you c:
<siery>
>> 'apeiros' == String
mlkkk has joined #ruby
BlopMonster has joined #ruby
roshanavand has quit [Ping timeout: 256 seconds]
<apeiros>
o0
<apeiros>
it's because == is an equality check. not a test for whether an object is an instance of a class.
<siery>
hmm.. how to use that eval? c:
<apeiros>
is_a?/kind_of?/instance_of? are
<apeiros>
you have to be registered
emilford has joined #ruby
mlkkk has quit [Remote host closed the connection]
<apeiros>
/ns help register
mlkkk has joined #ruby
jottr has quit [Ping timeout: 256 seconds]
raynold has quit [Quit: Connection closed for inactivity]
synthroid has joined #ruby
jottr has joined #ruby
griffindy has joined #ruby
BlopMonster has quit [Ping timeout: 264 seconds]
snickers has quit [Ping timeout: 256 seconds]
emilford has quit [Ping timeout: 265 seconds]
dalitom has joined #ruby
ramfjord has joined #ruby
mlkkk has quit [Ping timeout: 248 seconds]
aupadhye has quit [Ping timeout: 256 seconds]
emilford has joined #ruby
<dalitom>
Hey guys, noob here lol.....I need some advice. Basically I am trying to write a network discovery script in our lab, something like... discover all active IPs on each VALN and get information from physical gear ( servers and network gear) (MAC, COP capacity, RAM, HDD, etc). I wanted to go with SNMP but it needs to be enabled on all network gear and install agent on servers.
ramfjord has quit [Ping timeout: 264 seconds]
<dalitom>
Please advise, I will consider any type of idea
<dalitom>
Thanks
mlkkk has joined #ruby
biberu has quit [Ping timeout: 256 seconds]
<havenwood>
dalitom: My first thought was arp-scan. If you want to capture nearby packets, monitor mode with airmon-ng with airodump-ng.
ellcs has joined #ruby
shinnya has quit [Ping timeout: 260 seconds]
gray_-_wolf has joined #ruby
karapetyan has quit [Remote host closed the connection]
alfiemax has quit [Remote host closed the connection]
<dalitom>
havenwood: Well that's Backtrack/Kali stuff, I am writing this in Ruby. I got that part where I scan all VLANs and get active IPs with simple nmap. But actual communication with the server I cannot figure out, without installing SNMP agents
<havenwood>
dalitom: ah
howdoi has quit [Quit: Connection closed for inactivity]
<havenwood>
dalitom: Can you install DRb on each machine? ;-)
<havenwood>
use DRb*
<dalitom>
havenwood: :) no I do not have admin credentials to install agents :/
mtkd has quit [Ping timeout: 264 seconds]
<dminuoso>
havenwood: oh goodie, you were named on one of the major German tech websites
<cdunklau>
i know it's probably a tired question, so sorry in advance: what's the "best" ruby tutorial for experienced programmers?
Burgestrand has quit [Quit: Closing time!]
nowhere_man has quit [Ping timeout: 245 seconds]
<cjohnson>
metaprogramming ruby 2 is a book, not tutorial, but pretty good
bonhoefer has joined #ruby
<z64>
cdunklau: i would recommend "learn ruby the hard way" (though mind the dated style choices). if you find that a bit dull, you might try why's poignant guide. ultimately depends on your background / how you learn
<cdunklau>
z64: i'm not a fan of zed shaw's style :) i have heard of why's... does it assume some programming experience? my background is primarily python, with bits of php, perl, java, and C#
<cdunklau>
i like deep dives and tangents, but practical guides suit me as well
troys has joined #ruby
<NL3limin4t0r>
cdunklau: The codecademy for ruby is a pretty good start. The first few steps might be pretty dump if you'll are already an experienced programmer, but it picks up in the letter steps.
alfiemax has quit [Remote host closed the connection]
<cdunklau>
one thing that confused me at first was vagrant's avoidance of parens for method calls. is that the conventional style, or is it more of an opinionated thing
<cdunklau>
?
<cjohnson>
I find it to be fairly split
<z64>
if you're new to ruby style, look at the
chat has joined #ruby
<z64>
*ruby style guide
<elomatreb>
There are some different style guides, some recommend always leaving them off where they would be optional, some recommend an approach based on semantics
<z64>
and if you want, use rubocop and research the code it flags and why
<havenwood>
cdunklau: Some folk call avoiding parens unless it breaks the interpreter "Seattle style".
<havenwood>
cdunklau: (It's the style Seattle.rb uses.)
<elomatreb>
i.e. leave the parens off for "public" methods, use them for internals
jottr has joined #ruby
<havenwood>
I like omitting them, but follow the convention of the repo I'm working on.
<NL3limin4t0r>
cdunklau: If you're questioning some Ruby code style I mostly check it with the ruby-style-guide but you're free to do whatever you want. https://github.com/rubocop-hq/ruby-style-guide
<havenwood>
I do like how omitting parens often aligns with what's lovely to have on one line.
<havenwood>
I like that style a lot. I think omitting them makes it way easier to read. I have less trouble quickly parsing default precedence than trying to follow a bunch of ((..)..)
<derp10327>
lol I'm a cheater
<havenwood>
"When I read code that requires parentheses I eventually stop paying attention to them and treat them like whitespace."
alfiemax has quit [Remote host closed the connection]
<derp10327>
So I was attempting a fairly simple Ruby coding challenge that was just a cliché interview question: https://i.imgur.com/xO74vXu.png
chat has quit [Ping timeout: 260 seconds]
tcopeland has quit [Quit: tcopeland]
<derp10327>
Only problem was that I found out that the scales object wasn't actually an array, but it's own class, once I'd written all of the code to solve the problem.
karapetyan has quit [Remote host closed the connection]
gizmore|3 has joined #ruby
snickers has quit [Ping timeout: 264 seconds]
gizmore|2 has quit [Ping timeout: 240 seconds]
bonhoefer has quit [Ping timeout: 260 seconds]
gizmore has quit [Ping timeout: 256 seconds]
sysvalve has quit [Quit: Leaving]
andikr has quit [Remote host closed the connection]
howdoi has joined #ruby
tvw has quit [Remote host closed the connection]
amar_ has joined #ruby
fierycatnet has joined #ruby
paraxial has quit [Ping timeout: 260 seconds]
fierycatnet has quit [Client Quit]
amar has quit [Ping timeout: 256 seconds]
brianpWins has quit [Quit: brianpWins]
paraxial has joined #ruby
brianpWins has joined #ruby
nowhere_man has joined #ruby
TinkerT has joined #ruby
wkoszek_ has joined #ruby
TinkerT has quit [Client Quit]
TomyLobo has joined #ruby
guille-moe has quit [Ping timeout: 264 seconds]
chat__ has joined #ruby
paraxial has quit [Read error: Connection reset by peer]
paraxial has joined #ruby
wkoszek_ has quit [Ping timeout: 248 seconds]
chat_ has quit [Ping timeout: 256 seconds]
amar_ has quit [Remote host closed the connection]
agent_white has quit [Quit: leaving]
agent_white has joined #ruby
TinkerT has joined #ruby
amar has joined #ruby
brianpWins has quit [Quit: brianpWins]
jottr has joined #ruby
chat__ has quit [Ping timeout: 264 seconds]
chat_ has joined #ruby
roshanavand has joined #ruby
GodFather has quit [Ping timeout: 256 seconds]
eelster has joined #ruby
paraxial has quit [Ping timeout: 264 seconds]
paraxial has joined #ruby
amar has quit [Ping timeout: 240 seconds]
chat_ has quit [Ping timeout: 240 seconds]
chat__ has joined #ruby
Beams has quit [Quit: .]
lxsameer has quit [Ping timeout: 260 seconds]
paraxial has quit [Read error: Connection reset by peer]
nowhereman_ has joined #ruby
nowhere_man has quit [Ping timeout: 264 seconds]
kmurphy4 has joined #ruby
paraxial has joined #ruby
lxsameer has joined #ruby
badman has joined #ruby
lxsameer has quit [Ping timeout: 260 seconds]
chat_ has joined #ruby
mzo has joined #ruby
lxsameer has joined #ruby
paraxial has quit [Ping timeout: 264 seconds]
thebetrayer has quit [Ping timeout: 276 seconds]
chat__ has quit [Ping timeout: 260 seconds]
<havenwood>
baweaver: Not yet, but that looks like a fun one. Will do!
cadillac_ has quit [Ping timeout: 264 seconds]
chat_ has quit [Ping timeout: 260 seconds]
chat_ has joined #ruby
GodFather has joined #ruby
cadillac_ has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
paraxial has joined #ruby
jottr has quit [Ping timeout: 240 seconds]
Mike11 has quit [Ping timeout: 268 seconds]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BlopMonster has joined #ruby
GodFather has quit [Ping timeout: 276 seconds]
Mike11 has joined #ruby
lxsameer has joined #ruby
paraxial has quit [Ping timeout: 255 seconds]
<havenwood>
baweaver: Whats the thingy you use for code as an image in the tweets?
<havenwood>
oh, carbon, nvm!
paraxial has joined #ruby
Mike11 has quit [Changing host]
Mike11 has joined #ruby
BlopMonster has quit [Ping timeout: 245 seconds]
spiette has quit [Ping timeout: 256 seconds]
paraxial has quit [Read error: Connection reset by peer]
lxsameer has quit [Ping timeout: 264 seconds]
ldepandis has joined #ruby
dendazen has quit [Ping timeout: 265 seconds]
dionysus69 has quit [Ping timeout: 256 seconds]
alfiemax has joined #ruby
<baweaver>
carbon.now.sh - yeah
alfiemax_ has joined #ruby
lxsameer has joined #ruby
karapetyan has joined #ruby
chat_ has quit [Ping timeout: 276 seconds]
alfiemax has quit [Ping timeout: 264 seconds]
lxsameer has quit [Ping timeout: 240 seconds]
spiette has joined #ruby
chat_ has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
karapetyan has quit [Ping timeout: 265 seconds]
lxsameer has joined #ruby
mlkkk has quit [Remote host closed the connection]
bbobb has quit [Ping timeout: 245 seconds]
mtkd has quit []
alfiemax has joined #ruby
lxsameer has quit [Ping timeout: 264 seconds]
alfiemax has quit [Remote host closed the connection]
lxsameer has joined #ruby
alfiemax has joined #ruby
ramfjord has joined #ruby
chat__ has joined #ruby
lxsameer has quit [Ping timeout: 268 seconds]
jamesaxl has quit [Ping timeout: 240 seconds]
clemens3 has quit [Ping timeout: 256 seconds]
jamesaxl has joined #ruby
alfiemax has quit [Read error: Connection reset by peer]
chat_ has quit [Ping timeout: 248 seconds]
alfiemax has joined #ruby
mozzarella has quit [Quit: WeeChat 2.0.1]
amar has joined #ruby
lxsameer has joined #ruby
paraxial has joined #ruby
lxsameer has quit [Ping timeout: 260 seconds]
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
mzo has quit [Ping timeout: 260 seconds]
lxsameer has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
suukim has quit [Quit: Konversation terminated!]
quobo has quit [Quit: Connection closed for inactivity]
chat_ has joined #ruby
pastorinni has quit [Remote host closed the connection]
lxsameer has quit [Ping timeout: 264 seconds]
hays has joined #ruby
chat__ has quit [Ping timeout: 264 seconds]
Jiaoyin has joined #ruby
dionysus69 has joined #ruby
mtkd has joined #ruby
drale2k_ has joined #ruby
<Jiaoyin>
..so I created a class called "Piglet". I added a def to it called "speak". Inside of speak I have "puts "oink oink!". After that I closed the def and the class.
<Jiaoyin>
How do I puts out the string "oink oink!"
<Jiaoyin>
?
<Jiaoyin>
Inside the IRB do I type in................................ puts Piglet.speak
<Jiaoyin>
or...what?
lxsameer has joined #ruby
<Jiaoyin>
help?
<elomatreb>
First you need to load your file, so that irb knows about it
<elomatreb>
load "yourfilename.rb"
hobbes has joined #ruby
<Jiaoyin>
....so I have to save the whole Piglet.speak thing and re-open it up in IRB?
<elomatreb>
Oh, sorry. I thought had a file, nevermind that then
<elomatreb>
You created an instance method. You can now call it on an instance of the Piglet class (created using Piglet.new)
<Jiaoyin>
I'm just working/learning ruby with only the IRB
ellcs has joined #ruby
<Jiaoyin>
why Piglet.new ??? I didn't create a .new, did I?
hobbes has quit [Client Quit]
<elomatreb>
Do you know/understand the class<->instance relationship?
<Jiaoyin>
When I typed in "puts Piglet.new"........I got 0x0000000005098f80
<Jiaoyin>
well, not sure if I understand it. I thought I did. i guess not.
<elomatreb>
Indeed, that is the location of the instance (an object) you just created in memory
<Jiaoyin>
........how do I pull that out of the memory?
lxsameer has quit [Ping timeout: 256 seconds]
<elomatreb>
A class is like the blueprint for something, and you follow the instructions on it and build what it is for by calling .new on it (in Ruby)
<elomatreb>
You don't have to retrieve it from memory, Ruby does that for you. Ruby just doesn't know how to print a Piglet, so it falls back to telling you where it is, basically
<Jiaoyin>
So ".new" is something to use to see where it's stored in the memory?
<Jiaoyin>
k
<elomatreb>
Forget about memory for now, Ruby takes care of all of that for you
<Jiaoyin>
yea, that I get......but, how do I print/puts it on screen
za1b1tsu has quit [Quit: WeeChat 2.1]
thinkpad has quit [Ping timeout: 240 seconds]
<elomatreb>
There is nothing meaningful to print for now. You can try calling Piglet.new.speak
<Jiaoyin>
I see. That answers my question on how to puts it on screen, but what do you mean by it's nothing meaning to print for now?
<elomatreb>
Ruby has to know how to print something. Internally, your piglet is a data structure somewhere in memory, a whole bunch of more or less meaningless bytes
<elomatreb>
Some of these bytes are for remembering that it is a Piglet, some of them are for tracking relationships to other objects, and some of them are the actual "data"
thinkpad has joined #ruby
lxsameer has joined #ruby
<elomatreb>
If you don't define some code that tells Ruby what is interesting about it, it doesn't which of these bytes you really care about (i.e. a String is something different from an Array is something different from a Piglet)
<elomatreb>
(the method Ruby uses to turn something into something printable is `to_s`)
<Jiaoyin>
makes sense. So, how does someone add another string to it......interger or something else to Piglet.speak
<Jiaoyin>
???
<elomatreb>
That depends entirely on what you want to do
<Jiaoyin>
or...remove something that is already in Piglet......for example remove speak
<elomatreb>
Now we're back to the class-instance thing. You aren't calling speak on Piglet, but on an instance of the Piglet class
<Jiaoyin>
k
karapetyan has joined #ruby
<Jiaoyin>
Lets say I want to just add a new string of text to what I have previous. How do I do that?
<elomatreb>
You have to change the definition, and recreate the instances
<Jiaoyin>
Instead of it saying "oink oink!", I want it to say "Hello World" or add to it.
<elomatreb>
You can just open the class and the method definition again, the new method will override the old one
\void has joined #ruby
sauvin has quit [Remote host closed the connection]
lxsameer has quit [Ping timeout: 268 seconds]
cagomez has quit [Remote host closed the connection]
<elomatreb>
I suggest you find a Ruby tutorial/guide that starts with class basics, this is something fundamental you need to understand before anything else will make sense
cagomez has joined #ruby
karapetyan has quit [Ping timeout: 268 seconds]
<Jiaoyin>
yea, I know. That's what I'm doing right now. Taking a course. But I needed some help to sort things out, that's why I came here.
<Jiaoyin>
Thanks
<Jiaoyin>
I just tried it and it worked.
<Jiaoyin>
I just have another question..... how come puts Piglet.new.speak + "Hello" doesn't work? is there a better way of writing this?
<Jiaoyin>
without....changing speak like what we were talking before
lxsameer has joined #ruby
Cavallari has joined #ruby
<tobiasvl>
Jiaoyin: what do you mean by "doesn't work"
<Jiaoyin>
I'm trying to add "Hello" onto speak without changing speak.
<Jiaoyin>
puts Piglet.new.speak + "Hello"
<tobiasvl>
Jiaoyin: you should show your code, and explain what "doesn't work", ie. give a good description of the error and what you expect to happen
<tobiasvl>
how is Piglet's speak method defined?
<Jiaoyin>
Did that up there ^^^. But this is what I did........
<Jiaoyin>
class Piglet
<Jiaoyin>
def speak
<Jiaoyin>
puts "oink oink!"
<Jiaoyin>
end
<Jiaoyin>
end
<tobiasvl>
sorry, too much to read through up there
<Jiaoyin>
...and now I'm trying to add a string to it. Not by changing "speak"
<Jiaoyin>
I'm just doing this in the IRB
<tobiasvl>
OK, so your speak method does not return anything. when you do `puts Piglet.new.speak + "Hello"` you're saying "print out the return value of Piglet.new.speak and concatenate 'Hello' to it" but there is no reurn value.
lxsameer has quit [Ping timeout: 268 seconds]
[Butch] has joined #ruby
<Jiaoyin>
I know that by running puts Piglet.new.speak ..............it comes out "Hello"
<tobiasvl>
that's a side effect
<Jiaoyin>
side effect?
<tobiasvl>
you probably get an empty line as well
GodFather has joined #ruby
<tobiasvl>
when you do `puts Piglet.new.speak` you're saying "call Piglet.new.speak, and print out the return value afterwards". there is no return value. however, when calling Piglet.new.speak, that method itself prints out something
pskosinski has quit [Ping timeout: 264 seconds]
<Jiaoyin>
how do I make it a return value?
<tobiasvl>
Piglet.new.speak returns nil (as you can probably see in irb), because puts itself returns nil. nil basically means "no return value". if you `puts nil`, you just print an empty line (and return nil again).
<tobiasvl>
Jiaoyin: if you want to change the speak method to return the string, you must return it using the return keyword
<tobiasvl>
are you very new to programming?
<Jiaoyin>
yea
<tobiasvl>
do you know any other languages? ruby does it similarly to other languages, except that it also returns the value of the last expression if there's no explicit return statement
lxsameer has joined #ruby
<Jiaoyin>
when I run puts Piglet.new.speak .....I got "Hello" though
<Jiaoyin>
cuz I had the "Hello" string under speak before
<tobiasvl>
sure
<Jiaoyin>
I know a bit of python, but honestly I'm new to that as well so that doesn't count. Ruby is the first lanuage i'm actually trying to learn here.
eckhardt_ has joined #ruby
<Jiaoyin>
outside of python..
<tobiasvl>
ok, well, python is similar in that print() (the equivalent to puts) returns None (the equivalent to nil)
tdy has quit [Read error: Connection reset by peer]
<Jiaoyin>
i see, k
tdy has joined #ruby
Guest49921 has quit [Quit: ZNC 1.6.5+deb1 - http://znc.in]
SeepingN has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
safetypin has joined #ruby
pskosinski has joined #ruby
lxsameer has joined #ruby
kt has quit [Ping timeout: 265 seconds]
kt has joined #ruby
lxsameer has quit [Ping timeout: 276 seconds]
Mike11 has quit [Quit: Leaving.]
sameerynho has joined #ruby
lxsameer has joined #ruby
Cavallari has quit [Quit: Cavallari]
dust_ has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
schleppel has quit [Ping timeout: 264 seconds]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
face has quit [Read error: Connection reset by peer]
face has joined #ruby
ellcs has quit [Ping timeout: 256 seconds]
lxsameer has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
roshanavand has quit [Ping timeout: 248 seconds]
lxsameer has quit [Ping timeout: 265 seconds]
synthroid has quit [Remote host closed the connection]
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akaiiro has quit [Remote host closed the connection]
lxsameer has joined #ruby
Zaab1t has quit [Quit: Zaab1t]
Emmanuel_Chanel has joined #ruby
k0mpa has quit [Remote host closed the connection]
lxsameer has quit [Ping timeout: 276 seconds]
synthroid has quit []
lxsameer has joined #ruby
yawniek has joined #ruby
lxsameer has quit [Ping timeout: 264 seconds]
icarus has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 276 seconds]
jrafanie has quit [Ping timeout: 264 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has joined #ruby
Jiaoyin has quit [Quit: Page closed]
lxsameer has quit [Ping timeout: 265 seconds]
weird_error has quit [Quit: weird_error]
za1b1tsu has joined #ruby
ur5us has joined #ruby
fmcgeough has joined #ruby
fmartingr has quit [Quit: Connection closed for inactivity]
lxsameer has joined #ruby
BlopMonster has joined #ruby
za1b1tsu has quit [Quit: WeeChat 2.1]
pavtih has joined #ruby
agent_white has quit [Read error: Connection reset by peer]
lxsameer has quit [Ping timeout: 264 seconds]
za1b1tsu has joined #ruby
BlopMonster has quit [Ping timeout: 256 seconds]
nowhereman_ has quit [Ping timeout: 256 seconds]
za1b1tsu has quit [Client Quit]
chat has joined #ruby
lxsameer has joined #ruby
chat_ has quit [Ping timeout: 265 seconds]
zautomata has left #ruby ["WeeChat 1.9.1"]
mozzarella has joined #ruby
roshanavand has quit [Quit: Leaving.]
lxsameer has quit [Ping timeout: 245 seconds]
lxsameer has joined #ruby
Eiam has quit [Ping timeout: 256 seconds]
<siery>
Sorry, but I have to enter 9 lines of code to explain my problem. I been trying this on gamedev forum, but nobady answer, so maybe here I will have luck.
<siery>
File.foreach(f_map).with_index do |line, y|
<siery>
line.each_char.lazy.each_slice(2).map(&:first).with_index do |char, x|
reber has quit [Read error: Connection reset by peer]
<apeiros>
siery: see topic, paste >3 lines on a paste service
<siery>
So.. is there something wrong with above code? It seem to produce correct data, but after I wite this into my `Map` constructor the `Map` render stoped working :c
agent_white has joined #ruby
pavtih has quit [Quit: pavtih]
<apeiros>
the slice you're showing looks fine. the things I'd change are unlikely to be related to your problem.
<apeiros>
ah, `map(&:first).with_index` is probably wrong. by "stops working", do you mean you get an exception?
dalitom has quit [Ping timeout: 260 seconds]
<siery>
Not really, I'm getting the error: undefined method `draw' for nil:NilClass (NoMethodError)
<apeiros>
uh, that is an exception.
lxsameer has quit [Ping timeout: 264 seconds]
<apeiros>
for future reference, "does not work" is a terrible problem description. in case of an exception, the exception is already a much better description.
<apeiros>
anyway, "draw" is not called in the code above. so the piece you showed is insufficient.
Mike11 has joined #ruby
<siery>
Well, yes, so see..
RyanMcCoskrie has quit [Ping timeout: 264 seconds]
<siery>
The draw method is fair simple.. The part of code above shold feel @tiles instant 2D array with Tile objects.. and this seem to work, here is the state of @tiles[[0, 0]] inside Map.draw, bofore I call Tile.draw
<apeiros>
what does this error tell you "undefined method `draw' for nil:NilClass (NoMethodError)"?
jenrzzz_ has quit [Ping timeout: 256 seconds]
ramfjord has joined #ruby
<siery>
well, let me finish explaining, sorry, Im pretty slow at writing english c:
badman has quit [Ping timeout: 245 seconds]
<apeiros>
ok
<apeiros>
note: 0..x will is an off-by-one error. if x = 10, you'll iterate 11 times.
<apeiros>
use `x.times do |i|` instead.
kt has quit [Ping timeout: 248 seconds]
<apeiros>
(I mean instead of your `for y in 0..@width` and same for @height)
mostlybadfly has quit [Quit: Connection closed for inactivity]
safetypin has quit [Ping timeout: 265 seconds]
kt has joined #ruby
RougeR has quit [Ping timeout: 245 seconds]
<siery>
Simply as you see the Tile object calls it't instance of @spirite.draw with work really basic as well, thanks to gosu: https://paste.debian.net/1028126/
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<apeiros>
siery: please ping me when your explanation is complete
<apeiros>
(ping = write my nick)
<siery>
kk
<siery>
But I guess thats all data I get.. I spend few hours trying to fix that problem, but I guess I need to learn writing tests in Ruby to be more effective. So, thats really weird, I am getting the correct data when checking that object with pry, but the draw function is undefined.. I can't get it.
<siery>
@ apeiros
<apeiros>
I suggest you start with my question the :)
<apeiros>
*then
<apeiros>
what does this error tell you "undefined method `draw' for nil:NilClass (NoMethodError)"?
KeyJoo has quit [Ping timeout: 256 seconds]
<siery>
well.. It looks like this method is not defined in this class? nil:NilClass.. like that class is not existing... idk. But it is defined right bellow constructor
<apeiros>
the error tells you that you're trying to call draw on nil (an instance of NilClass)
ski7777 has quit [Remote host closed the connection]
<apeiros>
you should also have gotten additional information with the exception, that is, in which line this happens
<siery>
ah.. you are right apeiros C:.. but why is x and y still having the value last from the constructor? I didn't declare them as instant variables with @ but as locals.
<apeiros>
of course y will at some point be 11. why does that surprise you?
<apeiros>
or what do you think `for y in 0..@width` does?
<siery>
well, it is 11 when I brake that loop in draw method with binding.pry
<siery>
So before it starts iterating
<apeiros>
yes. meaning it has gone from 0 to 10 already and now is at 11
<siery>
changing x and y to i and j help
ur5us has quit [Remote host closed the connection]
<apeiros>
that won't change anything
<siery>
but it did
<apeiros>
if you changed the code the way I told you, you're not breaking out before iterating
<apeiros>
you're in pry during the iteration
<siery>
my map just been rendered corectly to the screen
mozzarella has quit [Quit: WeeChat 2.0.1]
lxsameer has quit [Ping timeout: 240 seconds]
<siery>
so why x was 0?
ramfjord has quit [Ping timeout: 240 seconds]
<apeiros>
why should it not be?
<apeiros>
you do 14 * 12 iterations, going through all combinations of x and y
<siery>
well, any ways y shold not be more then 10..
lxsameer has joined #ruby
<apeiros>
`for y in 0..@width` so this is 2 errors then?
griffindy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
@width instead of @height being error 1
<siery>
it is 11 at the end of the constructor becouse it reads an `/n` character, but not saving it to the @height
<apeiros>
and this being error 2:
<apeiros>
23:50 apeiros: note: 0..x will is an off-by-one error. if x = 10, you'll iterate 11 times.
<apeiros>
23:51 apeiros: use `x.times do |i|` instead.
ramfjord has joined #ruby
mozzarella has joined #ruby
Mike11 has quit [Quit: Leaving.]
akaiiro has joined #ruby
<apeiros>
(mind you, seeing the full code, there are more errors in your code too)
<siery>
ah.. true, so I just misspell x for y
<apeiros>
not just. see error 2.
karapetyan has quit [Remote host closed the connection]
ramfjord has quit [Ping timeout: 256 seconds]
<siery>
ah.. ya, good to see that being rendered correctly, now I can go back to making graphics ^_^
shinnya has joined #ruby
zapata has quit [Read error: Connection reset by peer]
<apeiros>
the "you have other errors in your code" went by without you taking notice?
karapetyan has joined #ruby
zapata has joined #ruby
ramfjord has joined #ruby
weaksauce has joined #ruby
amar has quit [Ping timeout: 240 seconds]
karapetyan has quit [Remote host closed the connection]
<siery>
What you mean apeiros?
<siery>
I fix both errors 1..2
dust_ has quit [Quit: Konversation terminated!]
<apeiros>
it's not as bad as I originally thought, but the way your `if char != ?\n and char.to_s != ' '` works, you can up with @tiles being incomplete.
<apeiros>
and `f_map = File.open(f_map, 'r')` does nothing in that code
lxsameer has quit [Ping timeout: 265 seconds]
<apeiros>
(yes, it does something, but what it does is useless)
lxsameer has joined #ruby
pastorinni has quit [Remote host closed the connection]
pastorinni has quit [Remote host closed the connection]
<siery>
ya.. I know `if char != ?\n and char.to_s != ' '` can leave some empty space with will be converted to 0, but I guess it is best in my situation, cose tiles with 0 code will be generated all around the map in camera field
moei has quit [Quit: Leaving...]
<siery>
I nedda hel me wife c:
alex`` has quit [Quit: WeeChat 2.1]
<Spiker01>
You see my messages (Maybe here atispam)?
<Spiker01>
antispam*
<siery>
Any ways.. removing this statement will not change any thing in functionality as `c = '\n'.to_i` and `c = ' '.to_i` is 0 as well, and I will spare some if
sanscoeur has quit [Ping timeout: 256 seconds]
akem has joined #ruby
kliq has quit [Ping timeout: 256 seconds]
cschneid has quit [Remote host closed the connection]
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<akem>
I have an issue with UTF-8, when printing it in the cygwin terminal window the string is ok and .encoding reports utf-8, but when i write it to a file using "w:utf-8", then opening the file in notepad++ it shows scrambled characters in place of accents and says encoding OEM-US. :/
lxsameer has joined #ruby
<havenwood>
akem: If you can, you might consider WSL instead of Cygwin, and Atom instead of Notepad++.
<havenwood>
akem: Windows Subsystem for Linux is far from perfect, but I think already more pleasant than Cygwin.
<Spiker01>
Incremental build: disabled. Enable with --incremental
<Spiker01>
Generating...
<Spiker01>
GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
<Spiker01>
fatal: Not a git repository (or any of the parent directories): .git
<Spiker01>
GitHub Metadata: Error processing value 'title':
<Spiker01>
Liquid Exception: No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configuration, or set up an 'origin' git remote pointing to your github.com repository. in atom.xml
<Spiker01>
ERROR: YOUR SITE COULD NOT BE BUILT:
<Spiker01>
------------------------------------
<Spiker01>
No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configuration, or set up an 'origin' git remote pointing to your github.com repository./// But I do not want to use the Git repository for hosting, I want to use it locally.
<baweaver>
Spiker01: Please use Gist to paste things next time
<baweaver>
!gist
<baweaver>
?gist
<ruby[bot]>
https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
<elomatreb>
You'll be kicked automatically if you flood too many lines
<Spiker01>
I can not understand in which file do I need to disable the Git profile support?
banisterfiend has joined #ruby
cagomez has quit [Remote host closed the connection]
t0xik has quit [Quit: Connection closed for inactivity]
cagomez has joined #ruby
<Spiker01>
English is not my native language. I can not understand what the program is writing to the console. Which file is edited to disable the support for the repositories? I do not understand the big and complex text.
cagomez has quit [Ping timeout: 240 seconds]
karapetyan has quit [Remote host closed the connection]