Skip to content
Browse files

Generalize render, implement render_html using it

  • Loading branch information...
1 parent 4a51d42 commit 9eb7ae5222d2a12e3f6beed151f1ba036ade139a Chris Wilson committed with May 12, 2012
View
1 .idea/.name
@@ -0,0 +1 @@
+graph_paper
View
7 .idea/.rakeTasks
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Settings><!--This file was automatically generated by Ruby plugin.
+You are allowed to:
+1. Remove rake task
+2. Add existing rake tasks
+To add existing rake tasks automatically delete this file and reload the project.
+--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="default" taksId="default" /></RakeGroup></Settings>
View
5 .idea/encodings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+
View
17 .idea/graph_paper.iml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="RUBY_MODULE" version="4">
+ <component name="NewModuleRootManager">
+ <content url="file://$MODULE_DIR$" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.1.3, RVM: jruby-head [graph_paper]) [gem]" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.1.3, RVM: jruby-head [graph_paper]) [gem]" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="rake (v0.8.7, RVM: jruby-head [graph_paper]) [gem]" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v2.10.0, RVM: jruby-head [graph_paper]) [gem]" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.10.0, RVM: jruby-head [graph_paper]) [gem]" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.10.0, RVM: jruby-head [graph_paper]) [gem]" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.10.1, RVM: jruby-head [graph_paper]) [gem]" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="rushcheck (v0.8, RVM: jruby-head [graph_paper]) [gem]" level="application" />
+ </component>
+</module>
+
View
5 .idea/misc.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: jruby-head [graph_paper]" project-jdk-type="JRUBY_SDK" />
+</project>
+
View
9 .idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/graph_paper.iml" filepath="$PROJECT_DIR$/.idea/graph_paper.iml" />
+ </modules>
+ </component>
+</project>
+
View
5 .idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+<component name="DependencyValidationManager">
+ <state>
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </state>
+</component>
View
7 .idea/vcs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
+ </component>
+</project>
+
View
572 .idea/workspace.xml
@@ -0,0 +1,572 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ChangeListManager">
+ <list default="true" id="734f7722-1cbf-43ce-9fdc-9022bb990026" name="Default" comment="">
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/graph_paper.iml" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/encodings.xml" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/modules.xml" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/scopes/scope_settings.xml" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/spec_helper.rb" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/Gemfile.lock" afterPath="$PROJECT_DIR$/Gemfile.lock" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/Gemfile" afterPath="$PROJECT_DIR$/Gemfile" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/Rakefile" afterPath="$PROJECT_DIR$/Rakefile" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/graph_paper/graph_paper.rb" afterPath="$PROJECT_DIR$/lib/graph_paper/graph_paper.rb" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/spec/graph_paper_spec.rb" afterPath="$PROJECT_DIR$/spec/graph_paper_spec.rb" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/test_graph_paper.rb" afterPath="$PROJECT_DIR$/test/test_graph_paper.rb" />
+ </list>
+ <ignored path="graph_paper.iws" />
+ <ignored path=".idea/workspace.xml" />
+ <option name="TRACKING_ENABLED" value="true" />
+ <option name="SHOW_DIALOG" value="false" />
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+ <option name="LAST_RESOLUTION" value="IGNORE" />
+ </component>
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
+ <component name="CreatePatchCommitExecutor">
+ <option name="PATCH_PATH" value="" />
+ </component>
+ <component name="DaemonCodeAnalyzer">
+ <disable_hints />
+ </component>
+ <component name="FavoritesManager">
+ <favorites_list name="graph_paper" />
+ </component>
+ <component name="FileEditorManager">
+ <leaf>
+ <file leaf-file-name="graph_paper.rb" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/lib/graph_paper/graph_paper.rb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="43" column="22" selection-start="1017" selection-end="1017" vertical-scroll-proportion="0.6">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="graph_paper_spec.rb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/spec/graph_paper_spec.rb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="23" column="61" selection-start="853" selection-end="853" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ </leaf>
+ </component>
+ <component name="FindManager">
+ <FindUsagesManager>
+ <setting name="OPEN_NEW_TAB" value="false" />
+ </FindUsagesManager>
+ </component>
+ <component name="Git.Settings">
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+ </component>
+ <component name="IdeDocumentHistory">
+ <option name="changedFiles">
+ <list>
+ <option value="$PROJECT_DIR$/.rspec" />
+ <option value="$PROJECT_DIR$/test/test_graph_paper.rb" />
+ <option value="$PROJECT_DIR$/spec/spec_helper.rb" />
+ <option value="$PROJECT_DIR$/spec/graph_paper_spec.rb" />
+ <option value="$PROJECT_DIR$/lib/graph_paper/graph_paper.rb" />
+ </list>
+ </option>
+ </component>
+ <component name="ProjectFrameBounds">
+ <option name="y" value="22" />
+ <option name="width" value="1440" />
+ <option name="height" value="874" />
+ </component>
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+ <OptionsSetting value="true" id="Add" />
+ <OptionsSetting value="true" id="Remove" />
+ <OptionsSetting value="true" id="Checkout" />
+ <OptionsSetting value="true" id="Update" />
+ <OptionsSetting value="true" id="Status" />
+ <OptionsSetting value="true" id="Edit" />
+ <ConfirmationsSetting value="0" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
+ </component>
+ <component name="ProjectReloadState">
+ <option name="STATE" value="0" />
+ </component>
+ <component name="ProjectView">
+ <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
+ <flattenPackages />
+ <showMembers />
+ <showModules />
+ <showLibraryContents />
+ <hideEmptyPackages />
+ <abbreviatePackageNames />
+ <autoscrollToSource />
+ <autoscrollFromSource />
+ <sortByType />
+ </navigator>
+ <panes>
+ <pane id="Scope">
+ <subPane subId="Project Files">
+ <PATH>
+ <PATH_ELEMENT USER_OBJECT="Root">
+ <option name="myItemId" value="" />
+ <option name="myItemType" value="" />
+ </PATH_ELEMENT>
+ </PATH>
+ </subPane>
+ </pane>
+ <pane id="ProjectPane">
+ <subPane>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="test" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="spec" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="lib" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="graph_paper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ </subPane>
+ </pane>
+ </panes>
+ </component>
+ <component name="PropertiesComponent">
+ <property name="WebServerToolWindowFactoryState" value="false" />
+ <property name="recentsLimit" value="5" />
+ <property name="FullScreen" value="false" />
+ <property name="RakeTaksPopup.undocumentedIncluded" value="false" />
+ </component>
+ <component name="RecentsManager">
+ <key name="MoveFile.RECENT_KEYS">
+ <recent name="$PROJECT_DIR$" />
+ </key>
+ </component>
+ <component name="RunManager" selected="Rake.spec">
+ <configuration default="false" name="test" type="RakeRunConfigurationType" factoryName="Rake" temporary="true">
+ <module name="graph_paper" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="test" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":test_unit " />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
+ <RunnerSettings RunnerId="RubyRunner" />
+ <ConfigurationWrapper RunnerId="RubyRunner" />
+ <method />
+ </configuration>
+ <configuration default="false" name="spec" type="RakeRunConfigurationType" factoryName="Rake" temporary="true">
+ <module name="graph_paper" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
+ <RunnerSettings RunnerId="RubyDebugRunner" />
+ <RunnerSettings RunnerId="RubyRunner" />
+ <ConfigurationWrapper RunnerId="RubyDebugRunner" />
+ <ConfigurationWrapper RunnerId="RubyRunner" />
+ <method />
+ </configuration>
+ <configuration default="false" name="GraphPaper should render dense html" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
+ <predefined_log_file id="RUBY_RSPEC" enabled="true" />
+ <module name="graph_paper" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$/spec" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs>
+ <env name="JRUBY_OPTS" value="-X+O" />
+ </envs>
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$PROJECT_DIR$/spec/graph_paper_spec.rb" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="GraphPaper should render dense html" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
+ <RunnerSettings RunnerId="RubyDebugRunner" />
+ <RunnerSettings RunnerId="RubyRunner" />
+ <ConfigurationWrapper RunnerId="RubyDebugRunner" />
+ <ConfigurationWrapper RunnerId="RubyRunner" />
+ <method />
+ </configuration>
+ <configuration default="true" type="RakeRunConfigurationType" factoryName="Rake">
+ <module name="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
+ <method>
+ <option name="RakeTask" enabled="false" />
+ </method>
+ </configuration>
+ <configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
+ <predefined_log_file id="RUBY_RSPEC" enabled="true" />
+ <module name="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
+ <method>
+ <option name="RakeTask" enabled="false" />
+ </method>
+ </configuration>
+ <configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby">
+ <module name="" />
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="" />
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="" />
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
+ <method>
+ <option name="RakeTask" enabled="false" />
+ </method>
+ </configuration>
+ <configuration default="true" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest">
+ <predefined_log_file id="RUBY_TESTUNIT" enabled="true" />
+ <module name="" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
+ <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
+ <method>
+ <option name="RakeTask" enabled="false" />
+ </method>
+ </configuration>
+ <list size="3">
+ <item index="0" class="java.lang.String" itemvalue="Rake.test" />
+ <item index="1" class="java.lang.String" itemvalue="Rake.spec" />
+ <item index="2" class="java.lang.String" itemvalue="RSpec.GraphPaper should render dense html" />
+ </list>
+ </component>
+ <component name="ShelveChangesManager" show_recycled="false" />
+ <component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="mySSHConnectionTimeout" value="30000" />
+ <option name="mySSHReadTimeout" value="30000" />
+ <option name="LAST_MERGED_REVISION" />
+ <option name="MERGE_DRY_RUN" value="false" />
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
+ <option name="DETECT_NESTED_COPIES" value="true" />
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
+ <option name="FORCE_UPDATE" value="false" />
+ <configuration useDefault="true">$USER_HOME$/.subversion_IDEA</configuration>
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
+ </component>
+ <component name="TaskManager">
+ <task active="true" id="Default" summary="Default task">
+ <created>1336854953058</created>
+ <updated>1336854953058</updated>
+ </task>
+ <servers />
+ </component>
+ <component name="ToolWindowManager">
+ <frame x="0" y="22" width="1440" height="874" extended-state="0" />
+ <editor active="true" />
+ <layout>
+ <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" />
+ <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" />
+ <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" />
+ <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" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.15876436" sideWeight="0.6010296" order="0" side_tool="false" content_ui="combo" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3989704" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+ <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" />
+ <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" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24195625" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <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" />
+ <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" />
+ <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" />
+ <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" />
+ <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" />
+ <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" />
+ <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" />
+ <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" />
+ </layout>
+ </component>
+ <component name="VcsContentAnnotationSettings">
+ <option name="myLimit" value="2678400000" />
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
+ <option name="CHECK_NEW_TODO" value="true" />
+ <option name="myTodoPanelSettings">
+ <value>
+ <are-packages-shown value="false" />
+ <are-modules-shown value="false" />
+ <flatten-packages value="false" />
+ <is-autoscroll-to-source value="false" />
+ </value>
+ </option>
+ <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
+ <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
+ <option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
+ <option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
+ <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
+ <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
+ <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
+ <option name="SHORT_DIFF_HORISONTALLY" value="true" />
+ <option name="SHORT_DIFF_EXTRA_LINES" value="2" />
+ <option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
+ <option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
+ <option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
+ <option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
+ <option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
+ <option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
+ <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
+ <option name="LAST_COMMIT_MESSAGE" />
+ <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
+ <option name="ACTIVE_VCS_NAME" />
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
+ <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
+ </component>
+ <component name="XDebuggerManager">
+ <breakpoint-manager />
+ </component>
+ <component name="editorHistoryManager">
+ <entry file="file://$PROJECT_DIR$/.rvmrc">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/README.md">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/.gitignore">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/graph_paper.gemspec">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Gemfile.lock">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Gemfile">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/Rakefile">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="2" column="2" selection-start="60" selection-end="60" vertical-scroll-proportion="0.0569395">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/test/test_graph_paper.rb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="75" selection-start="75" selection-end="75" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/spec/graph_paper_spec.rb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="23" column="61" selection-start="853" selection-end="853" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/lib/graph_paper/graph_paper.rb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="43" column="22" selection-start="1017" selection-end="1017" vertical-scroll-proportion="0.6">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </component>
+</project>
+
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use jruby-head@graph_paper --create
View
8 Gemfile
@@ -1,3 +1,7 @@
-gem "rushcheck"
+source :rubygems
gem "rake"
-gem "rspec"
+group :development do
+ gem 'rspec'
+ gem 'ruby-debug'
+ gem "rushcheck"
+end
View
23 Gemfile.lock
@@ -1,11 +1,34 @@
GEM
+ remote: http://rubygems.org/
specs:
+ columnize (0.3.6)
+ diff-lcs (1.1.3)
+ linecache (0.46)
+ rbx-require-relative (> 0.0.4)
rake (0.8.7)
+ rbx-require-relative (0.0.9)
+ rspec (2.10.0)
+ rspec-core (~> 2.10.0)
+ rspec-expectations (~> 2.10.0)
+ rspec-mocks (~> 2.10.0)
+ rspec-core (2.10.0)
+ rspec-expectations (2.10.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.10.1)
+ ruby-debug (0.10.4)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
+ linecache (>= 0.3)
+ ruby-debug-base (0.10.4-java)
rushcheck (0.8)
PLATFORMS
+ java
ruby
DEPENDENCIES
rake
+ rspec
+ ruby-debug
rushcheck
View
2 Rakefile
@@ -3,7 +3,7 @@ require 'rspec/core/rake_task'
Rake::TestTask.new do |t|
t.libs << 'test'
- t.test_files = FileList['test/test*.rb']
+ t.test_files = FileList['test/test*.rb', 'lib/graph_paper/*.rb']
t.verbose = true
end
View
73 lib/graph_paper/graph_paper.rb
@@ -4,12 +4,12 @@ def initialize args
@grid = Hash.new nil
args[:contents] ?
- set_contents(at_x: 0, at_y: 0, contents: args[:contents])
- : self
+ set_contents(at_x: 0, at_y: 0, contents: args[:contents])
+ : self
end
def cell x, y
- @grid[[x,y]]
+ @grid[[x, y]]
end
def set_contents args
@@ -26,6 +26,16 @@ def set_contents args
return self
end
+ def apply_offset args
+ at_x = args[:at_x] || 0
+ at_y = args[:at_y] || 0
+ offset_func = lambda {|k| [k[0] + at_x, k[1] + at_y]}
+ self.grid.reduce({}) do |h, (k, v)|
+ h[offset_func.call(k)] = v
+ h
+ end
+ end
+
def add_dimensions at_x, at_y, other
new_x = [x, at_x + other.x].max
new_y = [y, at_y + other.y].max
@@ -39,8 +49,8 @@ def compose_with other, args = {}
new_x, new_y = add_dimensions at_x, at_y, other
gp = GraphPaper.new x: new_x, y: new_y
- gp.grid = grid
- gp.grid.merge! other.grid.
+ gp.grid = self.grid
+ gp.grid.merge! other.apply_offset(at_x: at_x, at_y: at_y)
gp
end
@@ -54,54 +64,35 @@ def map_hash_keys f, h
end
def set_cell x, y, contents
- @grid[[x,y]] = contents
+ @grid[[x, y]] = contents
end
def grid_empty?
@grid.empty?
end
- def render_to_html args = {}
- tab = args[:joiner] ? (args[:tab] || ' ') : ''
- table = open_tag "table", args[:table_class]
- tr = open_tag "tr", args[:tr_class]
-
- out = []
- out << table
- x.times do |i|
- out << (tab*1) + tr
- y.times do |j|
- item = cell i, j
- unless item.nil?
- out << (tab*2) + tag("td", args[:td_class], item)
- else
- out << (tab*2) + tag("td")
- end
- end
- out << (tab*1) + "</tr>"
- end
- out << "</table>"
- args[:joiner] ? out.join(args[:joiner]) : out
+ def render_to_html(args = {})
+ t_class = args[:table_class] ? " class='#{args[:table_class]}'" : ''
+ r_class = args[:table_class] ? " class='#{args[:row_class]}'" : ''
+ c_class = args[:table_class] ? " class='#{args[:cell_class]}'" : ''
+
+ render lambda { |t| ["<table#{t_class}>"] + t + ['</table>']},
+ lambda { |r, tab| ["#{tab}<tr#{r_class}>"] + r + ["#{tab}</tr>"] },
+ lambda { |c, tab| ["#{tab}#{tab}<td#{c_class}>#{c}</td>"] },
+ args[:joiner], args[:tab]
end
protected
attr_accessor :grid, :x, :y
private
- def class_format item
- return '' if item.nil?
- item.empty? ? item : " class='#{item}'"
- end
-
- def open_tag name, tag_class = ""
- "<#{name}#{class_format tag_class}>"
- end
- def tag name, tag_class = "", contents = ""
- a = open_tag(name, tag_class)
- b = contents
- c = "</#{name}>"
- puts b, b.class
- open_tag(name, tag_class) + contents + "</#{name}>"
+ def render(wrap_table, wrap_row, wrap_cell, joiner='', tab='')
+ result = [wrap_table.call((0...x).map do |i|
+ wrap_row.call((0...y).map do |j|
+ wrap_cell.call(cell(i, j), tab)
+ end, tab)
+ end)].flatten
+ joiner ? result.join(joiner) : result
end
end
View
8 spec/graph_paper_spec.rb
@@ -1,5 +1,5 @@
require 'rspec'
-require './lib/graph_paper/graph_paper'
+require File.join(File.dirname(__FILE__), '..', 'lib/graph_paper/graph_paper')
describe GraphPaper do
let (:gp) { GraphPaper.new(x: 1, y: 1, contents: [["A"]]) }
@@ -9,7 +9,7 @@
end
it 'should render pretty-printed html' do
- gp.render_to_html(joiner: '\n').should == '<table>\n <tr>\n <td>A</td>\n </tr>\n</table>'
+ gp.render_to_html(joiner: '\n', tab: ' ').should == '<table>\n <tr>\n <td>A</td>\n </tr>\n</table>'
end
it 'should use custom tabs' do
@@ -23,6 +23,10 @@
it 'should overlay one table onto another' do
a.compose_with(b, at_x: 1, at_y: 1).render_to_html(joiner: '', tab: '').should == '<table><tr><td>A</td><td></td></tr><tr><td></td><td>B</td></tr></table>'
end
+
+ it 'should replace when overlaying' do
+ a.compose_with(b, at_x: 0, at_y: 0).render_to_html(joiner: '', tab: '').should == '<table><tr><td>B</td><td></td></tr><tr><td></td><td></td></tr></table>'
+ end
end
describe 'summing grid dimensions' do
View
3 spec/spec_helper.rb
@@ -0,0 +1,3 @@
+RSpec.configure do |config|
+ config.color_enabled = true
+end
View
2 test/test_graph_paper.rb
@@ -1,4 +1,4 @@
-require 'graph_paper'
+require File.join(File.dirname(__FILE__), '..', 'lib/graph_paper/graph_paper')
require 'rushcheck'
asrt_empty =

0 comments on commit 9eb7ae5

Please sign in to comment.
Something went wrong with that request. Please try again.