ccutrer / openhab-jrubyscripting

JRuby Libraries for Openhab
Eclipse Public License 2.0
1 stars 1 forks source link

transform syntactic sugar? #140

Closed ccutrer closed 1 year ago

ccutrer commented 1 year ago

Following up from https://github.com/boc-tothefuture/openhab-jruby/issues/9

Transform.map("mymap.map", 0)

might be useful?

NumberItem1.state.map("mymap.map")

maybe too, but would it be better to just have something like

NumberItem1.state_string

or something that simply takes the state pattern for the item (including a transformation if it's defined) and returns that instead?

jimtng commented 1 year ago

or something that simply takes the state pattern for the item (including a transformation if it's defined) and returns that instead?

I thought item.state.toString is supposed to do that

ccutrer commented 1 year ago

no, that simply stringifies a raw state, with no context of the item's state description