Skip to content

Instantly share code, notes, and snippets.

View gilbert's full-sized avatar
🪐
Security in space

Gilbert gilbert

🪐
Security in space
View GitHub Profile
@gilbert
gilbert / showcase.rb
Last active March 10, 2020 23:55
Minimal "states" mixin in Ruby
module HasStates
def state_field(column, state_names)
state_names.each do |name|
define_method("#{name}?") do
self.send(column) == name
end
end
end
end

Another file