tsundere 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.idea/.name ADDED
@@ -0,0 +1 @@
1
+ tsundere
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
data/.idea/misc.xml ADDED
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.9.2-p180 [global]" project-jdk-type="RUBY_SDK" />
4
+ <component name="SvnConfiguration" maxAnnotateRevisions="500">
5
+ <option name="USER" value="" />
6
+ <option name="PASSWORD" value="" />
7
+ <option name="mySSHConnectionTimeout" value="30000" />
8
+ <option name="mySSHReadTimeout" value="30000" />
9
+ <option name="LAST_MERGED_REVISION" />
10
+ <option name="MERGE_DRY_RUN" value="false" />
11
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
12
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
13
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
14
+ <option name="DETECT_NESTED_COPIES" value="true" />
15
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
16
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
17
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
18
+ <option name="FORCE_UPDATE" value="false" />
19
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
20
+ </component>
21
+ </project>
22
+
data/.idea/modules.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/tsundere.iml" filepath="$PROJECT_DIR$/.idea/tsundere.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
9
+
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.1.4, RVM: ruby-1.9.2-p180 [global]) [gem]" level="application" />
8
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.1.3, RVM: ruby-1.9.2-p180 [global]) [gem]" level="application" />
9
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v0.6.1, RVM: ruby-1.9.2-p180 [global]) [gem]" level="application" />
10
+ <orderEntry type="library" scope="PROVIDED" name="json (v1.7.5, RVM: ruby-1.9.2-p180 [global]) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="metaclass (v0.0.1, RVM: ruby-1.9.2-p180 [global]) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="rdoc (v3.12, RVM: ruby-1.9.2-p180 [global]) [gem]" level="application" />
13
+ </component>
14
+ </module>
15
+
data/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
7
+
@@ -0,0 +1,268 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="876e5741-713c-410f-86c2-71f50d2d32cf" name="Default" comment="">
5
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/tsundere/array.rb" afterPath="$PROJECT_DIR$/lib/tsundere/array.rb" />
6
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/spec/array_spec.rb" afterPath="$PROJECT_DIR$/spec/array_spec.rb" />
7
+ </list>
8
+ <ignored path="tsundere.iws" />
9
+ <ignored path=".idea/workspace.xml" />
10
+ <option name="TRACKING_ENABLED" value="true" />
11
+ <option name="SHOW_DIALOG" value="false" />
12
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
13
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
14
+ <option name="LAST_RESOLUTION" value="IGNORE" />
15
+ </component>
16
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
17
+ <component name="CreatePatchCommitExecutor">
18
+ <option name="PATCH_PATH" value="" />
19
+ </component>
20
+ <component name="DaemonCodeAnalyzer">
21
+ <disable_hints />
22
+ </component>
23
+ <component name="FavoritesManager">
24
+ <favorites_list name="tsundere" />
25
+ </component>
26
+ <component name="FileEditorManager">
27
+ <leaf>
28
+ <file leaf-file-name="array_spec.rb" pinned="false" current="false" current-in-tab="false">
29
+ <entry file="file://$PROJECT_DIR$/spec/array_spec.rb">
30
+ <provider selected="true" editor-type-id="text-editor">
31
+ <state line="58" column="35" selection-start="1661" selection-end="1661" vertical-scroll-proportion="0.0">
32
+ <folding />
33
+ </state>
34
+ </provider>
35
+ </entry>
36
+ </file>
37
+ <file leaf-file-name="array.rb" pinned="false" current="true" current-in-tab="true">
38
+ <entry file="file://$PROJECT_DIR$/lib/tsundere/array.rb">
39
+ <provider selected="true" editor-type-id="text-editor">
40
+ <state line="50" column="36" selection-start="1318" selection-end="1318" vertical-scroll-proportion="0.10764872">
41
+ <folding />
42
+ </state>
43
+ </provider>
44
+ </entry>
45
+ </file>
46
+ </leaf>
47
+ </component>
48
+ <component name="Git.Settings">
49
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
50
+ </component>
51
+ <component name="IdeDocumentHistory">
52
+ <option name="changedFiles">
53
+ <list>
54
+ <option value="$PROJECT_DIR$/spec/array_spec.rb" />
55
+ <option value="$PROJECT_DIR$/lib/tsundere/array.rb" />
56
+ </list>
57
+ </option>
58
+ </component>
59
+ <component name="ProjectFrameBounds">
60
+ <option name="y" value="58" />
61
+ <option name="width" value="1271" />
62
+ <option name="height" value="664" />
63
+ </component>
64
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
65
+ <OptionsSetting value="true" id="Add" />
66
+ <OptionsSetting value="true" id="Remove" />
67
+ <OptionsSetting value="true" id="Checkout" />
68
+ <OptionsSetting value="true" id="Update" />
69
+ <OptionsSetting value="true" id="Status" />
70
+ <OptionsSetting value="true" id="Edit" />
71
+ <ConfirmationsSetting value="0" id="Add" />
72
+ <ConfirmationsSetting value="0" id="Remove" />
73
+ </component>
74
+ <component name="ProjectReloadState">
75
+ <option name="STATE" value="0" />
76
+ </component>
77
+ <component name="ProjectView">
78
+ <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
79
+ <flattenPackages />
80
+ <showMembers />
81
+ <showModules />
82
+ <showLibraryContents />
83
+ <hideEmptyPackages />
84
+ <abbreviatePackageNames />
85
+ <autoscrollToSource />
86
+ <autoscrollFromSource />
87
+ <sortByType />
88
+ </navigator>
89
+ <panes>
90
+ <pane id="ProjectPane">
91
+ <subPane>
92
+ <PATH>
93
+ <PATH_ELEMENT>
94
+ <option name="myItemId" value="tsundere" />
95
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
96
+ </PATH_ELEMENT>
97
+ </PATH>
98
+ <PATH>
99
+ <PATH_ELEMENT>
100
+ <option name="myItemId" value="tsundere" />
101
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
102
+ </PATH_ELEMENT>
103
+ <PATH_ELEMENT>
104
+ <option name="myItemId" value="tsundere" />
105
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
106
+ </PATH_ELEMENT>
107
+ </PATH>
108
+ <PATH>
109
+ <PATH_ELEMENT>
110
+ <option name="myItemId" value="tsundere" />
111
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
112
+ </PATH_ELEMENT>
113
+ <PATH_ELEMENT>
114
+ <option name="myItemId" value="tsundere" />
115
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
116
+ </PATH_ELEMENT>
117
+ <PATH_ELEMENT>
118
+ <option name="myItemId" value="spec" />
119
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
120
+ </PATH_ELEMENT>
121
+ </PATH>
122
+ <PATH>
123
+ <PATH_ELEMENT>
124
+ <option name="myItemId" value="tsundere" />
125
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
126
+ </PATH_ELEMENT>
127
+ <PATH_ELEMENT>
128
+ <option name="myItemId" value="tsundere" />
129
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
130
+ </PATH_ELEMENT>
131
+ <PATH_ELEMENT>
132
+ <option name="myItemId" value="lib" />
133
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
134
+ </PATH_ELEMENT>
135
+ </PATH>
136
+ <PATH>
137
+ <PATH_ELEMENT>
138
+ <option name="myItemId" value="tsundere" />
139
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
140
+ </PATH_ELEMENT>
141
+ <PATH_ELEMENT>
142
+ <option name="myItemId" value="tsundere" />
143
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
144
+ </PATH_ELEMENT>
145
+ <PATH_ELEMENT>
146
+ <option name="myItemId" value="lib" />
147
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
148
+ </PATH_ELEMENT>
149
+ <PATH_ELEMENT>
150
+ <option name="myItemId" value="tsundere" />
151
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
152
+ </PATH_ELEMENT>
153
+ </PATH>
154
+ </subPane>
155
+ </pane>
156
+ <pane id="Scope" />
157
+ </panes>
158
+ </component>
159
+ <component name="PropertiesComponent">
160
+ <property name="WebServerToolWindowFactoryState" value="false" />
161
+ </component>
162
+ <component name="RunManager">
163
+ <list size="0" />
164
+ </component>
165
+ <component name="ShelveChangesManager" show_recycled="false" />
166
+ <component name="TaskManager">
167
+ <task active="true" id="Default" summary="Default task">
168
+ <created>1355268031085</created>
169
+ <updated>1355268031085</updated>
170
+ </task>
171
+ <servers />
172
+ </component>
173
+ <component name="ToolWindowManager">
174
+ <frame x="0" y="58" width="1271" height="664" extended-state="0" />
175
+ <editor active="true" />
176
+ <layout>
177
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.329806" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
178
+ <window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
179
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
180
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
181
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
182
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24938676" sideWeight="0.67019403" order="0" side_tool="false" content_ui="combo" />
183
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
184
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
185
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
186
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
187
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
188
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
189
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
190
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
191
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
192
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
193
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
194
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
195
+ </layout>
196
+ </component>
197
+ <component name="VcsContentAnnotationSettings">
198
+ <option name="myLimit" value="2678400000" />
199
+ </component>
200
+ <component name="VcsManagerConfiguration">
201
+ <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
202
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
203
+ <option name="CHECK_NEW_TODO" value="true" />
204
+ <option name="myTodoPanelSettings">
205
+ <value>
206
+ <are-packages-shown value="false" />
207
+ <are-modules-shown value="false" />
208
+ <flatten-packages value="false" />
209
+ <is-autoscroll-to-source value="false" />
210
+ </value>
211
+ </option>
212
+ <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
213
+ <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
214
+ <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
215
+ <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
216
+ <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
217
+ <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
218
+ <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
219
+ <option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
220
+ <option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
221
+ <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
222
+ <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
223
+ <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
224
+ <option name="SHORT_DIFF_HORISONTALLY" value="true" />
225
+ <option name="SHORT_DIFF_EXTRA_LINES" value="2" />
226
+ <option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
227
+ <option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
228
+ <option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
229
+ <option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
230
+ <option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
231
+ <option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
232
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
233
+ <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
234
+ <option name="LAST_COMMIT_MESSAGE" />
235
+ <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
236
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
237
+ <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
238
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
239
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
240
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
241
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
242
+ <option name="ACTIVE_VCS_NAME" />
243
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
244
+ <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
245
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
246
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
247
+ </component>
248
+ <component name="XDebuggerManager">
249
+ <breakpoint-manager />
250
+ </component>
251
+ <component name="editorHistoryManager">
252
+ <entry file="file://$PROJECT_DIR$/spec/array_spec.rb">
253
+ <provider selected="true" editor-type-id="text-editor">
254
+ <state line="58" column="35" selection-start="1661" selection-end="1661" vertical-scroll-proportion="0.0">
255
+ <folding />
256
+ </state>
257
+ </provider>
258
+ </entry>
259
+ <entry file="file://$PROJECT_DIR$/lib/tsundere/array.rb">
260
+ <provider selected="true" editor-type-id="text-editor">
261
+ <state line="50" column="36" selection-start="1318" selection-end="1318" vertical-scroll-proportion="0.10764872">
262
+ <folding />
263
+ </state>
264
+ </provider>
265
+ </entry>
266
+ </component>
267
+ </project>
268
+
data/Rakefile CHANGED
@@ -17,10 +17,10 @@ Jeweler::Tasks.new do |gem|
17
17
  gem.name = "tsundere"
18
18
  gem.homepage = "http://github.com/foxnewsnetwork/tsundere"
19
19
  gem.license = "MIT"
20
- gem.summary = %Q{object buffer for graceful managment of permission}
20
+ gem.summary = %Q{object buffer for graceful management of permission}
21
21
  gem.description = %Q{Any given object can implement the tsundere interface. Once implemented, a tsundere object will behave differently based upon who is calling it.}
22
22
  gem.email = "foxnewsnetwork@gmail.com"
23
- gem.authors = ["Thomas Chen"]
23
+ gem.authors = ["Thomas Chen", "Trevor Umeda"]
24
24
  # dependencies defined in Gemfile
25
25
  end
26
26
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -39,14 +39,22 @@ class Array
39
39
  def p_bisearch_internal s, f, target, right_flag, &eq
40
40
 
41
41
  mid = (f + s)/ 2
42
- return f if f == s
42
+ #small base case
43
+ if f == s
44
+ if yield( target , self[f]) > 0
45
+ return f+1
46
+ else
47
+ return f
48
+ end
49
+ end
43
50
  return s if count < 2
44
51
  result = yield target, self[mid]
45
52
  return mid if 0 == result
46
53
  if s + 1 == f
47
54
  if right_flag
48
- return s if yield(target, self[s]) <= 0 # target == self[s] or target < self[s]
49
- return f
55
+ return s if yield(target, self[s]) <= 0 # target == self[s] or target < self[s]
56
+ return f if yield(target,self[f]) <= 0
57
+ return f+1
50
58
  else
51
59
  return f if yield(target, self[f]) >= 0 # target == self[f] or target > self[f]
52
60
  return s
@@ -36,11 +36,6 @@ module Tsundere
36
36
  perm.each do |key, lvl|
37
37
  @rank_table[key] = lvl
38
38
 
39
- # FIXME: We really should not have to call sort here,
40
- # but for some reason the tree isn't being constructed
41
- # properly (i.e. the test won't pass), so I decided to
42
- # just say "fuck it" and put in a sort sort
43
- warn "FixMe: Take out this godawful sort from this insert by fixing the array extension and passing the array_spec"
44
39
  ind = permission_table[type][:array].binary_search_raw([lvl, attributes]) { |a1, a2| a1.first <=> a2.first }
45
40
  permission_table[type][:array].insert(ind, [lvl, attributes]).sort! { |a1, a2| a1.first <=> a2.first }
46
41
  end # each perm
data/spec/array_spec.rb CHANGED
@@ -1,59 +1,71 @@
1
1
  require 'spec_helper'
2
- require 'debugger'
2
+ #require 'debugger'
3
3
  describe Array do
4
- describe "binary search raw" do
5
- before :each do
4
+ describe "binary search raw" do
5
+ before :each do
6
6
  @array = [0,1,2,3,4,5,6,7,8,9]
7
7
  end # each
8
8
  10.times do |n|
9
- it "should have decent coverage #{n}" do
9
+ it "should have decent coverage #{n}" do
10
10
  @array.binary_search_raw(n).should eq n
11
11
  end # it
12
- it "should have decent coverage #{n} lean left" do
12
+ it "should have decent coverage #{n} lean left" do
13
13
  @array.binary_search_raw(n, :left => true).should eq n
14
14
  end # it
15
- it "should given #{n-0.5} it should get index #{n}" do
15
+ it "should, given #{n-0.5}, get index #{n}" do
16
16
  # debugger
17
17
  @array.binary_search_raw(n - 0.5).should eq n
18
18
  end # it
19
- it "should given #{n+0.5} it should get index #{n}" do
19
+ it "should, given #{n+0.5}, get index #{n}, with left preference" do
20
20
  # debugger
21
21
  @array.binary_search_raw(n + 0.5, :left => true).should eq n
22
22
  end # it
23
23
  end # each n
24
-
25
- it "should handle the empty array" do
24
+
25
+ it "should handle the empty array" do
26
26
  [].binary_search_raw(4).should eq 0
27
27
  end # it
28
- it "should handle odd input" do
28
+ it "should handle odd input" do
29
29
  @array.binary_search_raw(-1).should eq 0
30
30
  end # it
31
- it "should handle odd input on the big end " do
32
- @array.binary_search_raw(11).should eq 9
31
+ it "should handle odd input on the big end " do
32
+ @array.binary_search_raw(11).should eq 10
33
33
  end # it
34
34
 
35
- it "should handle the empty array left" do
35
+ it "should handle the empty array left" do
36
36
  [].binary_search_raw(4, :left => true).should eq 0
37
37
  end # it
38
- it "should handle odd input left" do
38
+ it "should handle odd input left" do
39
39
  @array.binary_search_raw(-1, :left => true).should eq 0
40
40
  end # it
41
- it "should handle odd input on the big end left" do
41
+ it "should handle odd input on the big end left" do
42
42
  @array.binary_search_raw(11, :left => true).should eq 9
43
43
  end # it
44
44
  end # bsr
45
45
 
46
- describe "construction" do
47
- it "should construct an ordered array" do
46
+ describe "construction" do
47
+ it "should construct an ordered array" do
48
48
  @array = []
49
49
  10.times do
50
50
  val = rand(100)
51
51
  ind = @array.binary_search_raw(val)
52
52
  @array.insert(ind, val)
53
53
  end # 10 times
54
-
54
+
55
55
  @array.count.should eq 10
56
56
  @array.should eq @array.sort
57
- end # it
57
+ end # it
58
+ it "should pass this random test" do
59
+ @array = []
60
+ val = 26
61
+ val2 = 9
62
+ ind = @array.binary_search_raw(val)
63
+ @array.insert(ind,val)
64
+ ind2 = @array.binary_search_raw(val2)
65
+
66
+ @array.insert(ind2,val2)
67
+ @array.should eq @array.sort
68
+
69
+ end
58
70
  end # construction
59
71
  end # Array
data/tsundere.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "tsundere"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Thomas Chen"]
12
- s.date = "2012-12-11"
11
+ s.authors = ["Thomas Chen", "Trevor Umeda"]
12
+ s.date = "2012-12-12"
13
13
  s.description = "Any given object can implement the tsundere interface. Once implemented, a tsundere object will behave differently based upon who is calling it."
14
14
  s.email = "foxnewsnetwork@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -18,6 +18,15 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
+ ".idea/.name",
22
+ ".idea/.rakeTasks",
23
+ ".idea/encodings.xml",
24
+ ".idea/misc.xml",
25
+ ".idea/modules.xml",
26
+ ".idea/scopes/scope_settings.xml",
27
+ ".idea/tsundere.iml",
28
+ ".idea/vcs.xml",
29
+ ".idea/workspace.xml",
21
30
  ".rspec",
22
31
  "Gemfile",
23
32
  "Gemfile.lock",
@@ -43,7 +52,7 @@ Gem::Specification.new do |s|
43
52
  s.licenses = ["MIT"]
44
53
  s.require_paths = ["lib"]
45
54
  s.rubygems_version = "1.8.24"
46
- s.summary = "object buffer for graceful managment of permission"
55
+ s.summary = "object buffer for graceful management of permission"
47
56
 
48
57
  if s.respond_to? :specification_version then
49
58
  s.specification_version = 3
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tsundere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Thomas Chen
9
+ - Trevor Umeda
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-12-11 00:00:00.000000000 Z
13
+ date: 2012-12-12 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: debugger
@@ -117,6 +118,15 @@ extra_rdoc_files:
117
118
  - README.markdown
118
119
  files:
119
120
  - .document
121
+ - .idea/.name
122
+ - .idea/.rakeTasks
123
+ - .idea/encodings.xml
124
+ - .idea/misc.xml
125
+ - .idea/modules.xml
126
+ - .idea/scopes/scope_settings.xml
127
+ - .idea/tsundere.iml
128
+ - .idea/vcs.xml
129
+ - .idea/workspace.xml
120
130
  - .rspec
121
131
  - Gemfile
122
132
  - Gemfile.lock
@@ -152,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
162
  version: '0'
153
163
  segments:
154
164
  - 0
155
- hash: 4316759713734857947
165
+ hash: -1940936912137567815
156
166
  required_rubygems_version: !ruby/object:Gem::Requirement
157
167
  none: false
158
168
  requirements:
@@ -164,5 +174,5 @@ rubyforge_project:
164
174
  rubygems_version: 1.8.24
165
175
  signing_key:
166
176
  specification_version: 3
167
- summary: object buffer for graceful managment of permission
177
+ summary: object buffer for graceful management of permission
168
178
  test_files: []