Displaying 6 results from an estimated 6 matches similar to: "traits-0.9.2 - better living through metaprogramming"
2006 Nov 04
0
traits-0.10.0
URLS
http://rubyforge.org/projects/codeforpeople/
http://codeforpeople.com/lib/ruby/traits
INSTALL
yes|sudo gem install traits
ABOUT
traits.rb is set of attr_* like methods on steroids, caffeine, and botox.
it encourages better living through meta-programming and uniform access
priciples. traits.rb supports smart inheritence of class attributes and a
fistful of hooks for
2017 Jul 03
2
type traits bug in clang 4.0.0?
Dear all,
I found this strange behavior, when inspecting some legacy build that did
not compile after an upgrade of several libraries and clang:
https://stackoverflow.com/questions/44846377/what-is-the-reason-behind-instable-type-traits
I got no conclusive answer, but a comment that indicates that this might
indeed be a bug in clang. Since I am neither a C++ expert nor familiar with
clang, I
2005 Dec 30
1
metaprogramming in controller: accessing instance variables
Hi all,
I''m trying to move a bunch of methods out of a controller into a
library that I can include and call a class method to have it
dynamically add a bunch of methods to the controller.
The goal is to just add to each controller:
include UIEnhancements::SubList
sub_list ''Note'', ''incomplete''
and have the sub_list method create all the methods
2008 Nov 13
3
metaprogramming with lm
Hello,
Say I want to make a multiple regression model with the following expression:
lm(y~x1 + x2 + x3 + ... + x_n,data=mydata)
It gets boring to type in the whole independent variables, in this
case x_i. Is there any simple way to do the metaprogramming for this?
(There are different cases where the names of the independent
variables might sometimes have apparent patterns or not)
2007 Jul 03
5
HOW TO: Easily output alternating item styles via metaprogramming
I always need to apply alternating item styles when outputting a collection,
here''s what I''ve been using recently.
In the app helper I define this method:
def alternate(items,alt=false
items.map{|i| i.class}.each { |k| k.class_eval {attr_accessor :alt}}
items.each { |i| i.alt, alt = alt, !alt }
end
When I call the partial I wrap the collection with this method:
2010 Dec 21
5
Rails, Ruby, haml, metaprogramming problem
In HAML I have hundreds of lines like the following:
- xyz = someFuncThatReturnsString(''xyz'')
and elsewhere
%div{''id'' => xyz}
The above lines work fine.
- - -
Attempting to keep things DRY (Don''t repeat yourself) I want to do
something like
- eval(otherFuncThatReturnsString(''xyz''))
where