문제

I'm dealing with this caveat:

https://github.com/zendesk/zendesk_api_client_rb#caveats

they have an example of adding a new element to the tags array and creating a new instance which trigger the changed? state.

I need to remove an element

도움이 되었습니까?

해결책

You could use the same technique they used, but with the -= operator.

>> a = []
=> []
>> a.object_id
=> 2154250660
>> a << 'hello'
=> ["hello"]
>> a.object_id
=> 2154250660
>> a += ['hi']
=> ["hello", "hi"]
>> a.object_id
=> 2154228260
>> a -= ['hi']
=> ["hello"]
>> a.object_id
=> 2154204700

다른 팁

Have you tried:

a -= [element]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top