Module: Weechat::Properties::ClassMethods
- Included in:
- Weechat::Properties
- Defined in:
- lib/weechat/properties.rb
Instance Method Summary (collapse)
- - (Object) all
- - (Object) apply_rtransformation(property, value)
- - (Object) apply_transformation(property, value)
- - (Object) init_properties
- - (Object) known_integer_properties
-
- (Array<Symbol>) known_properties
Returns all known properties.
- - (Object) known_string_properties
- - (Object) mappings
- - (Object) rtransformations
- - (Object) settable_properties
- - (Object) transformations
- - (Object) type
Instance Method Details
- (Object) all
39 40 41 42 43 44 45 |
# File 'lib/weechat/properties.rb', line 39 def all items = [] Weechat::Infolist.parse(@type).each do |item| items << from_ptr(item[:pointer]) end items end |
- (Object) apply_rtransformation(property, value)
89 90 91 |
# File 'lib/weechat/properties.rb', line 89 def apply_rtransformation(property, value) Utilities.apply_transformation(property, value, @rtransformations) end |
- (Object) apply_transformation(property, value)
85 86 87 |
# File 'lib/weechat/properties.rb', line 85 def apply_transformation(property, value) Utilities.apply_transformation(property, value, @transformations) end |
- (Object) init_properties
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/weechat/properties.rb', line 47 def init_properties @known_string_properties ||= [].freeze @known_integer_properties ||= [].freeze @settable_properties ||= [].freeze @transformations ||= {}.freeze @rtransformations ||= {}.freeze @mappings ||= {}.freeze @type = self.name.downcase.split("::").last # this defines all the getter methods known_properties.each do |property| define_method(property) { get_property(property) } end # this defined all the setter methods @settable_properties.each do |property| define_method(property + '=') {|v| set_property(property, v, true) } end # this adds a few aliases to make interfaces more rubyish @mappings.each do |key, value| if respond_to?(value) # it is a string/integer property alias_method key, value else # it is an infolist property define_method(key) do |*args| __send__(value, *args) end end end InstanceMethods.alias_methods(@type) include InstanceMethods end |
- (Object) known_integer_properties
11 12 13 |
# File 'lib/weechat/properties.rb', line 11 def known_integer_properties @known_integer_properties end |
- (Array<Symbol>) known_properties
Returns all known properties.
7 8 9 |
# File 'lib/weechat/properties.rb', line 7 def known_properties @known_integer_properties + @known_string_properties end |
- (Object) known_string_properties
15 16 17 |
# File 'lib/weechat/properties.rb', line 15 def known_string_properties @known_string_properties end |
- (Object) mappings
31 32 33 |
# File 'lib/weechat/properties.rb', line 31 def mappings @mappings end |
- (Object) rtransformations
27 28 29 |
# File 'lib/weechat/properties.rb', line 27 def rtransformations @rtransformations end |
- (Object) settable_properties
19 20 21 |
# File 'lib/weechat/properties.rb', line 19 def settable_properties @settable_properties end |
- (Object) transformations
23 24 25 |
# File 'lib/weechat/properties.rb', line 23 def transformations @transformations end |
- (Object) type
35 36 37 |
# File 'lib/weechat/properties.rb', line 35 def type @type end |