Class: Nuklear::UI::Base

Inherits:
Object
  • Object
show all
Includes:
Enableable, Events
Defined in:
lib/nuklear/ui/base.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Enableable

#disable, #disabled=, #disabled?, #enable, #enabled=, #enabled?

Methods included from Events

#event_listeners_for, #on, #trigger

Constructor Details

#initialize(enabled: true) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/nuklear/ui/base.rb', line 7

def initialize(enabled: true)
  self.enabled = enabled
end

Class Attribute Details

.dsl_method_nameObject



19
20
21
22
# File 'lib/nuklear/ui/base.rb', line 19

def dsl_method_name
  # Nukelar::UI::ColorPicker => 'color_picker'
  @dsl_method_name ||= name.split('::').last.gsub(/([A-Z])/) { |a| "_#{a.downcase}" }.sub(/^_/, '')
end

Class Method Details

.descendantsObject



24
25
26
# File 'lib/nuklear/ui/base.rb', line 24

def descendants
  @descendants ||= []
end

.inherited(child) ⇒ Object



28
29
30
# File 'lib/nuklear/ui/base.rb', line 28

def inherited(child)
  descendants << child
end

Instance Method Details

#dsl(&block) ⇒ Object



11
12
13
14
# File 'lib/nuklear/ui/base.rb', line 11

def dsl(&block)
  require 'nuklear/dsl'
  Nuklear::DSL.new(self, &block)
end