Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/alda-rb/patches.rb
Overview
Contains patches to Ruby’s core classes.
Instance Method Summary collapse
-
#detach_from_parent ⇒ Object
See Alda::Event#detach_from_parent.
-
#to_alda_code ⇒ Object
:call-seq: to_alda_code() -> String.
Instance Method Details
#detach_from_parent ⇒ Object
See Alda::Event#detach_from_parent.
74 75 76 |
# File 'lib/alda-rb/patches.rb', line 74 def detach_from_parent(...) each.reverse_each { _1.detach_from_parent(...) } end |
#to_alda_code ⇒ Object
:call-seq:
to_alda_code() -> String
See Alda::Event#to_alda_code. Behaves differently for Alda 1 and Alda 2 (due to a breaking change).
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/alda-rb/patches.rb', line 57 def to_alda_code contents = -> { map { "#{_1.to_alda_code} #{_2.to_alda_code}" }.join ' ' } if Alda.v1? "{#{contents.()}}" else thread = Thread.current if thread.inside_alda_list "(#{contents.()})" else thread.inside_alda_list = true "'(#{contents.()})".tap { thread.inside_alda_list = false } end end end |