Class: Module

Inherits:
Object show all
Includes:
Attributes
Defined in:
lib/alib-0.5.1/stdext.rb,
lib/alib-0.5.1/attributes.rb,
lib/alib-0.5.1/attributes-3.2.0.rb

Constant Summary

Constants included from Attributes

Attributes::VERSION

Instance Method Summary collapse

Methods included from Attributes

#attribute, #attributes, #version

Instance Method Details

#tattrs(*list) ⇒ Object Also known as: tattr



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/alib-0.5.1/stdext.rb', line 113

def tattrs *list 
#--{{{
  list.flatten.compact.map do |t|
    module_eval <<-code
      def #{ t } *a
        return(send('#{ t }', a.shift)) unless a.empty?
        Thread.current['#{ t }']
      end
      def #{ t }= val 
        Thread.current['#{ t }?'] = true 
        Thread.current['#{ t }'] = val
      end
      def #{ t }?
        Thread.current['#{ t }?']
      end
    code
    t.to_s
  end
#--}}}
end