Skip to content

Commit 8a51097

Browse files
committed
Update and rename adapter to adapter.md
1 parent 5774755 commit 8a51097

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: chapters/design_patterns/adapter renamed to chapters/design_patterns/adapter.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ To understand the problem completely best example would be an socket from our us
2020
This is exactly right situation to use adapter.
2121

2222
## Solution
23-
24-
#grid component
23+
{% highlight coffeescript %}
24+
# a fragment of 3-rd party grid component
2525
class AwesomeGrid
2626
constructor: (@datasource)->
2727
@sort_order = 'ASC'
@@ -52,6 +52,8 @@ agrid = new AwesomeGrid ['a','b','c','d','e','f']
5252
agrid.setCustomSorter new RandomSorterAdapter(new RandomSorter)
5353
agrid.sort() # sort data with custom sorter through adapter
5454

55+
{% endhighlight %}
56+
5557
## Discussion
5658

5759
Adapter is usefull when you have to organize an interaction between two objects with different interfaces. It can happen when you use 3-rd party libraries or you work with legacy code.

0 commit comments

Comments
 (0)