Class: ESPHome::Cli::Entities::Date

Inherits:
Form show all
Defined in:
lib/esphome/cli/entities/date.rb

Instance Attribute Summary

Attributes inherited from ESPHome::Cli::Entity

#cli, #index

Instance Method Summary collapse

Methods inherited from Form

#activate, #initial_value, #initialize, #suffix

Methods inherited from ESPHome::Cli::Entity

#initialize, #move_left, #move_right, #print, #touch

Constructor Details

This class inherits a constructor from ESPHome::Cli::Entities::Form

Instance Method Details

#command(value) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/esphome/cli/entities/date.rb', line 13

def command(value)
  begin
    value = Date.parse(value)
  rescue ArgumentError
    cli.error("Invalid date: #{value}")
    return
  end

  cli.info("Setting #{object_id_} to #{value.iso8601}")
  super
end

#length_rangeObject



9
10
11
# File 'lib/esphome/cli/entities/date.rb', line 9

def length_range
  3..11
end