| 1 | module Plugin::Mastodon |
| 2 | class Util |
| 3 | VISIBILITY2SELECT = { |
| 4 | 'public' => :'1public', |
| 5 | 'unlisted' => :'2unlisted', |
| 6 | 'private' => :'3private', |
| 7 | 'direct' => :'4direct' |
| 8 | }.freeze |
| 9 | SELECT2VISIBILITY = VISIBILITY2SELECT.to_h { |k, v| [v, k] } |
| 10 | class << self |
| 11 | def deep_dup(obj) |
| 12 | Marshal.load(Marshal.dump(obj)) |
| 13 | end |
| 14 | |
| 15 | def ppf(obj) |
| 16 | pp obj |
| 17 | $stdout.flush |
| 18 | end |
| 19 | |
| 20 | def visibility2select(visibility) |
| 21 | VISIBILITY2SELECT[visibility] |
| 22 | end |
| 23 | |
| 24 | def select2visibility(select) |
| 25 | SELECT2VISIBILITY[select] |
| 26 | end |
| 27 | end |
| 28 | end |
| 29 | end |