Class: Gtk::Builder
- Inherits:
-
Object
- Object
- Gtk::Builder
- Defined in:
- lib/gtk3/builder.rb
Instance Method Summary collapse
- #<<(target) ⇒ Object
- #add(target) ⇒ Object
- #add_from_string(string) ⇒ Object
- #add_from_string_raw ⇒ Object
-
#initialize(options = {}) ⇒ Builder
constructor
A new instance of Builder.
- #initialize_raw ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Builder
Returns a new instance of Builder.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gtk3/builder.rb', line 20 def initialize(={}) file = [:file] resource = [:resource] string = [:string] if file initialize_new_from_file(file) elsif resource initialize_new_from_resource(resource) elsif string initialize_new_from_string(string, string.bytesize) else initialize_raw end end |
Instance Method Details
#<<(target) ⇒ Object
55 56 57 58 |
# File 'lib/gtk3/builder.rb', line 55 def <<(target) add(target) self end |
#add(target) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/gtk3/builder.rb', line 43 def add(target) if target.respond_to?(:to_path) add_from_file(target.to_path) elsif target.start_with?("<") or target.start_with?(" ") add_from_string(target) elsif File.exist?(target) add_from_file(target) else add_from_resource(target) end end |
#add_from_string(string) ⇒ Object
39 40 41 |
# File 'lib/gtk3/builder.rb', line 39 def add_from_string(string) add_from_string_raw(string, string.bytesize) end |
#add_from_string_raw ⇒ Object
38 |
# File 'lib/gtk3/builder.rb', line 38 alias_method :add_from_string_raw, :add_from_string |
#initialize_raw ⇒ Object
19 |
# File 'lib/gtk3/builder.rb', line 19 alias_method :initialize_raw, :initialize |