Class: Lerna::Display
- Inherits:
-
Object
- Object
- Lerna::Display
- Defined in:
- lib/lerna/display.rb
Constant Summary collapse
- INTERNAL_TYPES =
%w[ LVDS ]
- DIGITAL_TYPES =
%w[ LVDS DP HDMI DVI ]
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #analog? ⇒ Boolean
- #connected? ⇒ Boolean
- #digital? ⇒ Boolean
- #external? ⇒ Boolean
-
#initialize(name, connected) ⇒ Display
constructor
A new instance of Display.
- #internal? ⇒ Boolean
- #type ⇒ Object
Constructor Details
permalink #initialize(name, connected) ⇒ Display
Returns a new instance of Display.
11 12 13 14 |
# File 'lib/lerna/display.rb', line 11 def initialize(name, connected) @name = name @connected = connected end |
Instance Attribute Details
permalink #name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/lerna/display.rb', line 16 def name @name end |
Class Method Details
permalink .parse(line) ⇒ Object
[View source]
6 7 8 9 |
# File 'lib/lerna/display.rb', line 6 def self.parse(line) name, status, = line.split(/\s/) new(name, status == 'connected') end |
Instance Method Details
permalink #==(other) ⇒ Object
[View source]
42 43 44 |
# File 'lib/lerna/display.rb', line 42 def ==(other) [name, connected?] == [other.name, other.connected?] end |
permalink #analog? ⇒ Boolean
38 39 40 |
# File 'lib/lerna/display.rb', line 38 def analog? !digital? end |
permalink #connected? ⇒ Boolean
18 19 20 |
# File 'lib/lerna/display.rb', line 18 def connected? @connected end |
permalink #digital? ⇒ Boolean
34 35 36 |
# File 'lib/lerna/display.rb', line 34 def digital? DIGITAL_TYPES.include?(type) end |
permalink #external? ⇒ Boolean
30 31 32 |
# File 'lib/lerna/display.rb', line 30 def external? !internal? end |
permalink #internal? ⇒ Boolean
26 27 28 |
# File 'lib/lerna/display.rb', line 26 def internal? INTERNAL_TYPES.include?(type) end |
permalink #type ⇒ Object
[View source]
22 23 24 |
# File 'lib/lerna/display.rb', line 22 def type name.sub(/-?\d+$/, '') end |