Module: OpenHAB::Core::Items::Semantics::TagClassMethods
- Defined in:
- lib/openhab/core/items/semantics/tag_class_methods.rb
Overview
Adds tag attributes to the semantic tag class
Instance Method Summary collapse
-
#description(locale = nil) ⇒ String
Returns the tag's description.
-
#label(locale = nil) ⇒ String
Returns the tag's label.
-
#synonyms(locale = nil) ⇒ Array<String>
Returns the tag's synonyms.
-
#to_s ⇒ String
Returns the tag's string representation.
Instance Method Details
#description(locale = nil) ⇒ String
Returns the tag's description
62 63 64 65 66 67 68 |
# File 'lib/openhab/core/items/semantics/tag_class_methods.rb', line 62 def description(locale = nil) unless SemanticTags.respond_to?(:get_description) return java_class.get_annotation(org.openhab.core.semantics.TagInfo.java_class).description end SemanticTags.get_description(java_class, locale || java.util.Locale.default) end |
#label(locale = nil) ⇒ String
Returns the tag's label
33 34 35 |
# File 'lib/openhab/core/items/semantics/tag_class_methods.rb', line 33 def label(locale = nil) SemanticTags.get_label(java_class, locale || java.util.Locale.default) end |
#synonyms(locale = nil) ⇒ Array<String>
Returns the tag's synonyms
45 46 47 48 49 50 51 52 |
# File 'lib/openhab/core/items/semantics/tag_class_methods.rb', line 45 def synonyms(locale = nil) unless SemanticTags.respond_to?(:get_synonyms) return java_class.get_annotation(org.openhab.core.semantics.TagInfo.java_class).synonyms .split(",").map(&:strip) end SemanticTags.get_synonyms(java_class, locale || java.util.Locale.default).to_a end |
#to_s ⇒ String
Returns the tag's string representation
21 22 23 |
# File 'lib/openhab/core/items/semantics/tag_class_methods.rb', line 21 def to_s java_class.simple_name end |