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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(screen, id) ⇒ Crtc

Returns a new instance of Crtc.



18
19
20
21
# File 'lib/screen/crtc.rb', line 18

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



30
31
32
# File 'lib/screen/crtc.rb', line 30

def method_missing(name)
  attribute(name)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#screenObject (readonly)

Returns the value of attribute screen.



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

def screen
  @screen
end

Class Method Details

.finalize(attributes) ⇒ Object



13
14
15
# File 'lib/screen/crtc.rb', line 13

def finalize(attributes)
  proc{ Xlib.XRRFreeCrtcInfo(attributes.pointer) }
end

Instance Method Details

#attribute(attribute) ⇒ Object



25
26
27
28
# File 'lib/screen/crtc.rb', line 25

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

#outputsObject



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

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