bazz1tv / ayumi

My lovely IRC bot :sparkles: :turtle: :mailbox: :sparkles:
0 stars 1 forks source link

auto-map Cinch config.yml hash to cinch config-variables #68

Closed bazz1tv closed 8 years ago

bazz1tv commented 8 years ago

I'll have to separate Cinch config options that 1:1 (config:variable-names) into their own hash (yml) -- then I can map that in the following way: config.each { |k,v| c.send("#{k}=", v) }

Then map the other non-cinch (ayumi) "discrepancy" data manually

<bazzy> Is there a way to programatically correlate the following pattern: 
[23:34]  <bazzy> c.user = config["user"]
[23:34]  <bazzy>             c.realname = config["realname"]
[23:34]  <bazzy>             c.server = config["server"]
[23:35]  <bazzy> we see the string is the same as the variable ... 
[23:35]  <bazzy> I'd like to, if possible, not have to manually correlate the data
[23:35]  * danielpclark (~danielpcl@c-71-62-7-94.hsd1.va.comcast.net) has joined #ruby
[23:35]  <Radar> is it always the same?
[23:35]  <bazzy> if it wasn't, I don't think I could consider this as a solution .. 
[23:35]  <bazzy> unfortunately, I can only say, "for now, yes" 
[23:35]  * LoneHermit has quit (Remote host closed the connection)
[23:36]  <bazzy> It should be that way for a very long time AFAIK
[23:36]  <Radar> If it's a perfect 1-to-1 match then you can do this
[23:36]  <Radar> config.each { |k,v| c.send("#{k}=", v) }
[23:36]  <Radar> But if it's not, then you'll have to specify them manually as you have been doing.
[23:36]  * hahuang61 has quit (Ping timeout: 250 seconds)
[23:37]  * kareeoleez (~kareeolee@ppp005054118211.access.hol.gr) has joined #ruby
[23:37]  <bazzy> it looks like my safest option is to stay manual .. I am noticing some discrepancies in the assignments 
[23:38]  <bazzy> hm.. actually .. I see a way to separate the "discrepancy" options so that I can group the non-discrepancies into their own hash .. and be able to reap the benefits of automatic assignment there
[23:38]  * bruno- has quit (Ping timeout: 252 seconds)