Module: Weechat::Properties::ClassMethods
- Included in:
- Weechat::Properties
- Defined in:
- lib/weechat/properties.rb
Instance Method Summary collapse
- #apply_transformation(property, value) ⇒ Object
- #init_properties ⇒ Object
- #known_integer_properties ⇒ Object
-
#known_properties ⇒ Array<Symbol>
Returns all known properties.
- #known_string_properties ⇒ Object
- #mappings ⇒ Object
- #rtransformations ⇒ Object
- #settable_properties ⇒ Object
- #transformations ⇒ Object
- #type ⇒ Object
Instance Method Details
#apply_transformation(property, value) ⇒ Object
77 78 79 |
# File 'lib/weechat/properties.rb', line 77 def apply_transformation(property, value) Utilities.apply_transformation(property, value, @transformations) end |
#init_properties ⇒ Object
39 40 41 42 43 44 45 46 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 |
# File 'lib/weechat/properties.rb', line 39 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 |
#known_integer_properties ⇒ Object
11 12 13 |
# File 'lib/weechat/properties.rb', line 11 def known_integer_properties @known_integer_properties end |
#known_properties ⇒ Array<Symbol>
Returns all known properties.
7 8 9 |
# File 'lib/weechat/properties.rb', line 7 def known_properties @known_integer_properties + @known_string_properties end |
#known_string_properties ⇒ Object
15 16 17 |
# File 'lib/weechat/properties.rb', line 15 def known_string_properties @known_string_properties end |
#mappings ⇒ Object
31 32 33 |
# File 'lib/weechat/properties.rb', line 31 def mappings @mappings end |
#rtransformations ⇒ Object
27 28 29 |
# File 'lib/weechat/properties.rb', line 27 def rtransformations @rtransformations end |
#settable_properties ⇒ Object
19 20 21 |
# File 'lib/weechat/properties.rb', line 19 def settable_properties @settable_properties end |
#transformations ⇒ Object
23 24 25 |
# File 'lib/weechat/properties.rb', line 23 def transformations @transformations end |
#type ⇒ Object
35 36 37 |
# File 'lib/weechat/properties.rb', line 35 def type @type end |