Swyper has quit [Remote host closed the connection]
<Nathanael7>
Does anyone knows if there is a way to copy the signature of a callable dynamically? (you want to make an alias of a method, but you would like the proxy method to have the same signature than the original method, and not a catch all that you forward)
mikecmpbll has joined #ruby
<Nathanael7>
You can do some introspection on a signature through `parameters` but I have not found a way to reuse that when defining a method / block / proc
jenrzzz has quit [Ping timeout: 276 seconds]
Guest92538 has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
duderono_ has joined #ruby
<bovis>
NL3limin4t0r: Looks like that will make the HTML pretty for me, which is better than what I have. Wouldn't I still run into the problem of defining where a block of content begins and ends?
<bovis>
Even using just one column of data: Cell 1 needs to be different than Cell 2. If I can make them pretty from their current state, then I should be able to parse the data without Nokogiri
GodFather has joined #ruby
<NL3limin4t0r>
Nathanael7: Have you already taken a look at #arity?
duderono_ has quit [Read error: Connection reset by peer]
<Nathanael7>
My issue is more: assuming you get something valid from `.parameters`, how do you reuse it to define another method?
duderono_ has quit [Read error: Connection reset by peer]
duderon__ has joined #ruby
<Nathanael7>
(Sorry I mispoke: if you use keywords args, you should not expect extra arguments after, the arity can be more than 1 if they were named arguments before)
codefriar has joined #ruby
<Nathanael7>
And yeah sorry I missed your point anyway: parameters does not give you the default values you are right
<markand>
why documentations are so different? std-lib / core have different style, hierarchy
<havenwood>
markand: different folk wrote them
duderon__ has quit [Read error: Connection reset by peer]
<havenwood>
Nathanael7: Shy of using Fiddle, there's no way to copy a method's signature. I'm curious to see the context of the code where you're wanting to.
drincruz has joined #ruby
<havenwood>
markand: what are you referring to as "core documentation"?
sagax has quit [Read error: Connection reset by peer]
<havenwood>
markand: what you linked to are the docs.
<Nathanael7>
havenwood: trying to reason about code validity at parse time when using railsway programming
<havenwood>
markand: That's just a totally different site, not maintained by Ruby.
<markand>
ah okay
duderono_ has quit [Read error: Connection reset by peer]
<havenwood>
markand: The first link has stdlib and core docs.
<markand>
:-)
<Nathanael7>
havenwood: I'm chaining a bunch of methods that all receive keyword args, but with different signatures, so instead of adding a double splats to all the definition the code that calls these methods checks what they expect to receive
<Nathanael7>
havenwood: on top of that, I want to add Contracts to enforce higher level signature constraints, so there will be some method proxying
kith has joined #ruby
DTZUZO has joined #ruby
<Nathanael7>
I think the only solution left is to make sure that the "organizer" code that observes the methods before calling them can access the initial method without the contracts
duderono_ has quit [Read error: Connection reset by peer]
cow[moo] has joined #ruby
duderono_ has joined #ruby
drincruz has joined #ruby
<Nathanael7>
havenwood yeah there are a bunch of type systems available, the issue is when they redefine the method to add some checks at runtime, you loose the ability to do some introspection on the real method
<havenwood>
RDL, Steep & Sorbet are the three level two type checkers that'll use Ruby 3's RBS from Ruby::Signature: https://github.com/ruby/ruby-signature
<Nathanael7>
havenwood yes I've actually checked them all :D But a type system is too limited, I want to be able to describe higher level constraint
DTZUZO has quit [Ping timeout: 240 seconds]
<Nathanael7>
Sorbet doesn't support it and from what I've seen neither will Ruby::Signature
grilix has joined #ruby
schne1der has quit [Ping timeout: 268 seconds]
<havenwood>
Nathanael7: Signature knows things about the code that are beyond #parameters, like default arguments.
sagax has joined #ruby
<havenwood>
Nathanael7: You could I guess alternatively use Ripper or even RubyVM::InstructionSequence yourself I suppose to get at it. Maybe default arguments don't matter for you?
<Nathanael7>
havenwood: yes, but I am interested in checking against values as well (being able to define a type that's only valid for an integer range for instance)
<havenwood>
Nathanael7: For example, Signature knows: method type (::String x, ::Integer i, foo: 123 foo) { (Integer) -> Array[Integer] } -> ::String
<Nathanael7>
havenwood yeah they don't really, I can even bypass the aliased method actually
<Nathanael7>
It's just sad when you're blocked by the language because of its design
<Nathanael7>
Not the end of the world though
banisterfiend has joined #ruby
<Nathanael7>
So far Contracts works better because you can actually leverage some pattern matching + type checking + data checking (when you go deeper than "keyword args pattern matching")
<Nathanael7>
Actually I might be wrong about Ruby Signature as they have Literal types
kyrylo has joined #ruby
tobiasvl has quit [Ping timeout: 246 seconds]
drincruz has quit [Ping timeout: 276 seconds]
Emmanuel_Chanel has quit [Quit: Leaving]
duderono_ has quit [Read error: Connection reset by peer]
lucasb has joined #ruby
duderonomy has joined #ruby
duderonomy is now known as Guest35264
brool has joined #ruby
Guest35264 has quit [Read error: Connection reset by peer]
duderono_ has joined #ruby
Nathanael7 has quit [Remote host closed the connection]
tvl has joined #ruby
tvl is now known as tobiasvl
Emmanuel_Chanel has joined #ruby
hutch1 has quit [Ping timeout: 245 seconds]
drincruz has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
schne1der has joined #ruby
elphe has joined #ruby
Swyper has quit [Remote host closed the connection]
duderono_ has quit [Read error: Connection reset by peer]
duderono_ has joined #ruby
Swyper has joined #ruby
duderono_ has quit [Read error: Connection reset by peer]
AJA4350 has quit [Ping timeout: 276 seconds]
duderono_ has joined #ruby
Swyper has quit [Ping timeout: 265 seconds]
etupat has quit [Remote host closed the connection]
duderono_ has quit [Read error: Connection reset by peer]
duderonomy has joined #ruby
duderonomy is now known as Guest54446
sagax has quit [Quit: Konversation terminated!]
sagax has joined #ruby
kith has quit [Quit: kith]
<havenwood>
Ruby 2.6.5!
jenrzzz has quit [Ping timeout: 265 seconds]
Technodrome has joined #ruby
zodd_ has joined #ruby
MrCrackPot has joined #ruby
Guest54446 has quit [Read error: Connection reset by peer]
hutch1 has quit [Ping timeout: 252 seconds]
duderono_ has joined #ruby
<zodd_>
when using ruby on Windows I seem unable to install certain gems. However some others install fine, but are not recognized by the interactive interpreter. How can I tackle this please?
conta2 has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dionysus69 has quit [Ping timeout: 240 seconds]
<zodd_>
(odbc not found, same for rubygems. dbi and sequel can be found and install, but cannot be used) --> installing from cmd in c:\ruby using bin\gem install <gem>
brendan- has joined #ruby
<zodd_>
maybe I use the wrong path/location to install?
<havenwood>
zodd_: Show the issues for a single gem? What are you trying that isn't working and what's the error?
duderono_ has quit [Read error: Connection reset by peer]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderono_ has joined #ruby
conta2 has quit [Ping timeout: 245 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
galaxie has quit [Remote host closed the connection]
etupat has quit [Remote host closed the connection]
<zodd_>
gem which dbi --> C:/Ruby-x64/lib/ruby/gems/2.5.0/dbi-0.4.5/lib/dbi.rb
<zodd_>
seems ok
<zodd_>
might the problem be that irb is not dynamic (ie: if one installs new gems from an other terminal (cmd) it is not picked up/noticed?)
<havenwood>
zodd_: gem env gempath
<havenwood>
zodd_: The gemdir is where gems are installed (doesn't match dbi's location) and gempath is where Ruby will search for gems.
<zodd_>
ok. My assumption seems right: opening a new irb allows me tosuccesfully require ¨dbi¨
<havenwood>
zodd_: Ah, gotcha. Yup.
<zodd_>
thanks havenwood
<havenwood>
zodd_: In Pry you can get around that with `gem-install dbi` from inside Pry.
<havenwood>
?pry
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
xco has quit [Quit: xco]
<havenwood>
zodd_: Or instead of restarting irb you can: exec($0)
SashaZakharchuk has quit [Quit: Connection closed for inactivity]
<zodd_>
cool
szTheory has joined #ruby
<havenwood>
which is just: exec 'irb'
<zodd_>
next question: odbc :P It is available under Linux (but badly build by packagers which makes it unusable), but is not available for Windows?
<zodd_>
sole reason why I try to run code under Windows
<havenwood>
zodd_: I don't follow. What's your goal?
<havenwood>
zodd_: What's the end goal?
<zodd_>
create/use an odbc connection from Ruby. The ruby-odbc package from Debian (and other distros) are not correctly build, so will not work. Therefor I am testing my POC on Windows
<havenwood>
zodd_: Why ODBC? Need to connect to a MS SQL Server?
mikecmpbll has quit [Quit: inabit. zz.]
<zodd_>
No I want to connect to a database engine not being Oracle/MS.
<havenwood>
Gotcha.
<zodd_>
I need ODBC for that
<zodd_>
no other way
xco has joined #ruby
<havenwood>
I was going to recommend TinyTDS if Microsft SQL Server or Sybase.
kyrylo has joined #ruby
yokel has quit [Ping timeout: 265 seconds]
ElFerna has joined #ruby
ElFerna has quit [Client Quit]
<havenwood>
zodd_: What's wrong with the odbc gem?
yokel has joined #ruby
<havenwood>
zodd_: It looks like sequel's odbc adapter doesn't require a gem.
<havenwood>
zodd_: An OS from 2011 would be more likely to work. :(
<zodd_>
lol
greengriminal has joined #ruby
_mossplix has quit [Ping timeout: 240 seconds]
<zodd_>
I am quite happy I was/am not writing code ment for production purposes
<zodd_>
iirc there are distros in which it works so I assume it is a building/dependency issue
<zodd_>
as I normally do not code in Ruby I have not investigated this fully. I just filed a bug which is most likely not to be resolved, but could be usefull for the next person who wonders why her/his code does not work
clemens3 has quit [Quit: WeeChat 1.6]
<zodd_>
(I have not tried/tested installing the odbc gem using gem install, but used the ruby-odbc package from Debian)
<havenwood>
zodd_: Try?: gem install ruby-odbc
<zodd_>
doing so on Windows atm. It tries to build the gem!?!
wald0 has quit [Quit: Lost terminal]
<havenwood>
zodd_: Yeah, you'll need DevKit installed for a Windows gem to build.
ogres has quit [Quit: Connection closed for inactivity]
<zodd_>
I have multiple MSYS/MINGW installs on my Windows box and it seems to be using one
ogres has joined #ruby
mikecmpbll has joined #ruby
hutch1 has joined #ruby
FastJack has quit [Ping timeout: 264 seconds]
FastJack has joined #ruby
evdubs has quit [Remote host closed the connection]
evdubs has joined #ruby
codefriar has quit [Ping timeout: 240 seconds]
jnix has joined #ruby
Eiam has quit [Ping timeout: 250 seconds]
codefriar has joined #ruby
_mossplix has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
xco has quit [Quit: xco]
greengriminal has joined #ruby
<zodd_>
I just tested some code using DBI+ODBC which resulted in: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in load_driver´
<ruby[bot]>
BustyLoli-Chan: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<BustyLoli-Chan>
My example has like {"excludeSwitches" => ["enable-automation"]}) and my currently code has what other languages believe me to be some kind of { } object... I'm thinking I just need to add excludeSwitches: ["enable-automation"] to that somehow, but I'm new to ruby and have no idea what I'm doing.
ogres has quit [Quit: Connection closed for inactivity]
Ai9zO5AP has joined #ruby
<BustyLoli-Chan>
my attempts to nest this object array thingy so far have not worked with like excludeSwitches: ["enable-automation"] or excludeSwitches: {["enable-automation"]} or excludeSwitches: {"enable-automation"}
Ai9zO5AP has quit [Excess Flood]
fphilipe has quit [Ping timeout: 276 seconds]
poontangmessiah has joined #ruby
gray_-_wolf has quit [Quit: WeeChat 2.5]
MrCrackPot has quit [Quit: Something went wrong again oh the joys]
tpanarch1st_ has joined #ruby
<Iambchop>
BustyLoli-Chan: please define "have not worked." No error message but wrong behavior, crashes with error message, formats C:, etc. :)