mirror of
https://github.com/esphome/esphome.git
synced 2025-10-31 23:21:54 +00:00
preen
This commit is contained in:
@@ -63,18 +63,16 @@ optional<size_t> Select::index_of(const char *option) const {
|
|||||||
optional<size_t> Select::active_index() const {
|
optional<size_t> Select::active_index() const {
|
||||||
if (this->has_state()) {
|
if (this->has_state()) {
|
||||||
return this->active_index_;
|
return this->active_index_;
|
||||||
} else {
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
optional<std::string> Select::at(size_t index) const {
|
optional<std::string> Select::at(size_t index) const {
|
||||||
if (this->has_index(index)) {
|
if (this->has_index(index)) {
|
||||||
const auto &options = traits.get_options();
|
const auto &options = traits.get_options();
|
||||||
return std::string(options.at(index));
|
return std::string(options.at(index));
|
||||||
} else {
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Select::option_at(size_t index) const { return traits.get_options().at(index); }
|
const char *Select::option_at(size_t index) const { return traits.get_options().at(index); }
|
||||||
|
|||||||
Reference in New Issue
Block a user