Skip to content

Commit 20d8806

Browse files
sleewoomeh
authored andcommittedFeb 10, 2015
socket: add aliases for write
People who always used `send` in javascript will be confused about `NoMethodError: undefined method` exception :) And people who worked with sockets in Ruby will definitely expect a `<<` method.
1 parent 58a87b0 commit 20d8806

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

Diff for: ‎opal/browser/socket.rb

+4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ def write(data)
107107
`#@native.send(#{data.to_n})`
108108
end
109109

110+
alias << write
111+
112+
alias send write
113+
110114
# Close the socket.
111115
#
112116
# @param code [Integer, nil] the error code

0 commit comments

Comments
 (0)
Please sign in to comment.