Class: XlibObj::Screen::Crtc

Inherits:
Object
  • Object
show all
Defined in:
lib/screen/crtc.rb,
lib/screen/crtc/output.rb

Defined Under Namespace

Classes: Output

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(screen, id) ⇒ Crtc

Returns a new instance of Crtc.



12
13
14
15
16
17
18
19
# File 'lib/screen/crtc.rb', line 12

def initialize(screen, id)
  @screen = screen
  @id = id

  ObjectSpace.define_finalizer(self) do
    Xlib.XRRFreeCrtcInfo(@attributes.pointer) if @attributes
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



28
29
30
# File 'lib/screen/crtc.rb', line 28

def method_missing(name)
  attribute(name)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



21
22
23
# File 'lib/screen/crtc.rb', line 21

def id
  @id
end

#screenObject (readonly)

Returns the value of attribute screen.



21
22
23
# File 'lib/screen/crtc.rb', line 21

def screen
  @screen
end

Instance Method Details

#attribute(attribute) ⇒ Object



23
24
25
26
# File 'lib/screen/crtc.rb', line 23

def attribute(attribute)
  return unless attributes.layout.members.include? attribute.to_sym
  attributes[attribute.to_sym]
end

#outputsObject



32
33
34
35
36
37
38
# File 'lib/screen/crtc.rb', line 32

def outputs
  (0..attribute(:noutput)-1).map do |output_number|
    output_id(attribute(:outputs), output_number)
  end.map do |output_id|
    Output.new(self, output_id)
  end
end