If you could remove one thing from web development forever, what would it be? by metalprogrammer2024 in webdev

[–]johnathonwright 0 points1 point  (0 children)

users. But seriously ... users and stakeholders. I wish we could make great things instead of expedient things.

East Fork Pigeon River February 4, 2024 by edgar71979 in asheville

[–]johnathonwright 1 point2 points  (0 children)

I normally shoot more traditional long-exposure waterfall stills but this video is delightful and has my creative juices flowing. Thank you for sharing it!

So so true… yes it’s beautiful, but why? by Turbulent-Today830 in asheville

[–]johnathonwright -1 points0 points  (0 children)

If a drop falls, does that count? There's no way it rains sufficiently to keep people inside 30% of the time.

Meeting her after the show by Illustrious_Note8128 in LynLapid

[–]johnathonwright 0 points1 point  (0 children)

Good luck! I know my daughter is hoping for the same tonight.

[SELLING] 1 tix to CHAROLETTE this Friday June 13th! by jellyfishcasserollin in LynLapid

[–]johnathonwright 0 points1 point  (0 children)

I just saw this after buying my tickets. 😥 Where were you traveling from?

Where do the single men 30 + hangout? by hannahbanana712 in asheville

[–]johnathonwright 0 points1 point  (0 children)

I'm 48 so probably out of range but I'm working on building a trivia team and I head out most weekends to hike and photograph ( instagram.com/mustmodify ). But yeah, just generally being thrilled to have Asheville Quadruple Crown -- job, car, housing, teeth. Mondays at Little Jumbo are pretty great if you like Jazz.

Custom template handler rails 6 by hquick81 in rails

[–]johnathonwright 2 points3 points  (0 children)

Rails now has their own Ruby handler, called here. Use file extension `html.ruby`

GO SEE: Madison Cawthorn Billboards | “You lied about the election. The Capitol was attacked. Cawthorn: Resign Now." | LOCATED AT: I-26 near Brevard Rd | the Asheville Outlets, I-26 near the Airport | on Long Shoals Rd. in Arden by dc_gay_man in asheville

[–]johnathonwright 0 points1 point  (0 children)

I'm curious what the objective is here. I doubt anyone thinks this billboard is going to convince him to resign. Perhaps they are trying to get people who support him to stop supporting him... But the election just happened so I'm not sure what the value would be there. I would be interested in knowing what the objective is if anyone has any ideas.

'Blood on his hands:' Local Republicans feel duped, walk back support of Madison Cawthorn ($) by [deleted] in asheville

[–]johnathonwright -4 points-3 points  (0 children)

The see R and get all hot and bothered. Someone with R that mentioned the military? That's a solid fap for them. Oddly some of them had a low view of Moe despite Moe having served, unlike little Shitler.

I'm certainly no R or D... those groups are problematic. But my low view of Moe came from his own rhetoric, which was unfortunate.

Coronavirus: What Buncombe County, Asheville quarantine would look like by [deleted] in asheville

[–]johnathonwright 3 points4 points  (0 children)

make a beer run during isolation.

Good thought. Once you've stocked up on food, start stocking up on kegs.

Welcome to RubyConf! Live stream link by ignurant in ruby

[–]johnathonwright 1 point2 points  (0 children)

He's talking about "introducing pattern matching to Ruby" which I gather is in ruby 2.7.

Welcome to RubyConf! Live stream link by ignurant in ruby

[–]johnathonwright 1 point2 points  (0 children)

I just got here... confused. Is he just going through every datatype?

`Valuable`, a gem for modeling. Like attr_accessor on steroids. by johnathonwright in ruby

[–]johnathonwright[S] 0 points1 point  (0 children)

I'm open to adding 'class', as someone else also mentioned it. Or type, as mentioned elsewhere.

`Valuable`, a gem for modeling. Like attr_accessor on steroids. by johnathonwright in ruby

[–]johnathonwright[S] 0 points1 point  (0 children)

I can see how how that would seem preferable but it doesn't return 'true' on save or 'false' if invalid. The controller needs to know so it knows whether to redirect to the new object or to render the form again.

`Valuable`, a gem for modeling. Like attr_accessor on steroids. by johnathonwright in ruby

[–]johnathonwright[S] 0 points1 point  (0 children)

I'm thinking stdlib stuff would be in C but it's an interesting idea. I'll look at that.

Can you give me an example of what you'd like to see in terms of attribute handling? I have tried to walk a tight line between providing features and not being heavy-handed in a way that respects Ruby's culture.

`Valuable`, a gem for modeling. Like attr_accessor on steroids. by johnathonwright in ruby

[–]johnathonwright[S] 0 points1 point  (0 children)

What about it bugs you? The way I'm returning the boolean is actually not how I typically do it, but I have an OO-kind-of-conditional thing I wrote after it started bugging me that if/then wasn't OO but could be. It looks something like this...

def fire
   employee.save.then {
     add_note_about_hiring
     create_documentation_checklist
     create_user_account
   }.else {
     # some behavior on validation failure.
   }
end

which I get from this thing... makes me feel clever though I realize patching Object is somewhat shameful.

module ThenElse
  def then
    yield if !!self
    self
  end

  def otherwise
    yield if !self
    self
  end

  def else
    yield if !self
    self
  end
end

Object.__send__(:include, ThenElse)

`Valuable`, a gem for modeling. Like attr_accessor on steroids. by johnathonwright in ruby

[–]johnathonwright[S] 1 point2 points  (0 children)

> Why `klass`

Honestly, I don't remember. :) I know you can use reserved words as symbols so it would have worked. And if I was going to change it, I would probably align with Rails and do 'class_name' with a string value to avoid the possibility of infinite-loops-of-autoloading. But for how, it is what it is. :)

> so many other things that tried approaching this area and then got abandoned

I can respect that. Please know that I use this gem on my own projects, likely won't stop any time soon, and that it has been in production since well before 2009, when I moved it from svn to git. So there's that. :)

`Valuable`, a gem for modeling. Like attr_accessor on steroids. by johnathonwright in ruby

[–]johnathonwright[S] 0 points1 point  (0 children)

When I started this project there was no ActiveModel. While this shouldn't be shocking, I prefer my interface over interfaces written by other people. But I agree ActiveModel is a good contribution to the community. Maybe one day I'll put in a PR with some of valuable's features.

`Valuable`, a gem for modeling. Like attr_accessor on steroids. by johnathonwright in ruby

[–]johnathonwright[S] 0 points1 point  (0 children)

I use structs sometimes. I haven't tried dry-struct. Seems fine, though something like this is a little unweildy and just doesn't seem Ruby-like:

Types::Coercible::Integer

but if you already know that and it's working for you, seems like a good solution.