10 Matching Annotations
- Feb 2022
-
github.com github.com
-
Replaces your Rails controllers, views and forms with meta programming. Considers routes.rb, ability.rb, current_user and does the right thing.
-
- Aug 2021
-
www.botsquad.com www.botsquad.com
-
medium.com medium.com
-
def destructure(method_name) meta_klass = class << self; self end method_proc = method(method_name) unless method_proc.parameters.all? { |t, _| t == :key } raise "Only works with keyword arguments" end arguments = method_proc.parameters.map(&:last) destructure_proc = -> object { values = if object.is_a?(Hash) object else arguments.map { |a| [a, object.public_send(a)] }.to_h end method_proc.call(values) } meta_klass.send(:define_method, method_name, destructure_proc) method_nameend
-
- Jun 2021
-
stackoverflow.com stackoverflow.com
-
class << Object def private_accessor(*names) names.each do |name| attr_accessor name private "#{name}=" end end end
-
-
github.com github.com
-
%w{ JsonDashArrow JsonDashDoubleArrow JsonHashArrow JsonHashDoubleArrow JsonbAtArrow JsonbArrowAt JsonbQuestion JsonbQuestionAnd JsonbQuestionOr CastJson }.each do |name| const_set name, Class.new(Binary) end
-
- Feb 2021
-
unix.stackexchange.com unix.stackexchange.com
-
for sig in $(kill -l) ; do trap "echo parent:$sig" $sig done
-
-
en.wikipedia.org en.wikipedia.org
-
The modern sense of "an X about X" has given rise to concepts like "meta-cognition" (cognition about cognition), "meta-emotion" (emotion about emotion), "meta-discussion" (discussion about discussion), "meta-joke" (joke about jokes), and "metaprogramming" (writing programs that manipulate programs).
-
-
doc.rust-lang.org doc.rust-lang.org
-
The most widely used form of macros in Rust is declarative macros. These are also sometimes referred to as “macros by example,” “macro_rules! macros,” or just plain “macros.” At their core, declarative macros allow you to write something similar to a Rust match expression.
Tags
Annotators
URL
-
- Apr 2020
-
stackoverflow.com stackoverflow.com
-
Ruby 2.1 added local_variable_set, but that cannot create new local variables either
-
-
stackoverflow.com stackoverflow.com
-
binding.local_variable_get and binding.local_variable_set
-