Class: TFClient::Models::Brightness

Inherits:
Model
  • Object
show all
Defined in:
lib/textflight-client/models/nav.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#label, #translation, #values_hash

Instance Method Summary collapse

Constructor Details

#initialize(line:) ⇒ Brightness

Returns a new instance of Brightness.



131
132
133
134
135
# File 'lib/textflight-client/models/nav.rb', line 131

def initialize(line:)
  super(line: line)
  @value = @values_hash[:brightness].to_i
  @percent = ((@value/255.0) * 100).round
end

Instance Attribute Details

#percentObject (readonly)

Returns the value of attribute percent.



129
130
131
# File 'lib/textflight-client/models/nav.rb', line 129

def percent
  @percent
end

#valueObject (readonly)

Returns the value of attribute value.



129
130
131
# File 'lib/textflight-client/models/nav.rb', line 129

def value
  @value
end

Instance Method Details

#to_sObject



137
138
139
# File 'lib/textflight-client/models/nav.rb', line 137

def to_s
  %Q[#{@translation}: #{@value} => #{@percent}%]
end