-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e14eff
commit b672e27
Showing
23 changed files
with
5,542 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
== 1.0.1 | ||
|
||
* Changed inclusion method to use apply_addresslogic instead of include Addresslogic. This allows you to pass options and specify alternate fields. | ||
|
||
== 1.0.0 | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
init.rb | ||
lib/addresslogic/version.rb | ||
lib/addresslogic.rb | ||
MIT-LICENSE | ||
Rakefile | ||
Manifest.txt | ||
README.rdoc | ||
test/addresslogic_tests.rb | ||
Rakefile | ||
init.rb | ||
lib/addresslogic.rb | ||
lib/addresslogic/version.rb | ||
test/test_addresslogic.rb | ||
test/test_helper.rb | ||
Manifest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
require 'rubygems' | ||
ENV['RDOCOPT'] = "-S -f html -T hanna" | ||
|
||
require "rubygems" | ||
require "hoe" | ||
require File.dirname(__FILE__) << "/lib/addresslogic/version" | ||
require 'echoe' | ||
|
||
Echoe.new 'addresslogic' do |p| | ||
p.version = Addresslogic::Version::STRING | ||
Hoe.new("Addresslogic", Addresslogic::Version::STRING) do |p| | ||
p.name = "addresslogic" | ||
p.rubyforge_name = "addresslogic" | ||
p.author = "Ben Johnson of Binary Logic" | ||
p.email = 'bjohnson@binarylogic.com' | ||
p.project = 'addresslogic' | ||
p.summary = "Tools for displaying addresses" | ||
p.summary = "Easily display addresses." | ||
p.description = "Easily display addresses." | ||
p.url = "http://github.com/binarylogic/addresslogic" | ||
p.dependencies = %w(echoe) | ||
p.history_file = "CHANGELOG.rdoc" | ||
p.readme_file = "README.rdoc" | ||
p.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc"] | ||
p.remote_rdoc_dir = '' | ||
p.test_globs = ["test/*/test_*.rb", "test/*_test.rb", "test/*/*_test.rb"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
<html lang='en'> | ||
<head> | ||
<title>: Addresslogic [addresslogic-1.0.0 Documentation]</title> | ||
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'> | ||
<link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'> | ||
<script type='text/javascript'> | ||
//<![CDATA[ | ||
function popupCode(url) { | ||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") | ||
} | ||
|
||
function toggleCode(id) { | ||
var code = document.getElementById(id) | ||
|
||
code.style.display = code.style.display != 'block' ? 'block' : 'none' | ||
return true | ||
} | ||
|
||
// Make codeblocks hidden by default | ||
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>') | ||
//]]> | ||
</script> | ||
</head> | ||
<body class='page'> | ||
<div class='class' id='wrapper'> | ||
<div class='header'> | ||
<div class='name'> | ||
<span class='type'>Module</span> | ||
Addresslogic | ||
</div> | ||
<ol class='paths'> | ||
<li> | ||
<a href="../files/lib/addresslogic/version_rb.html">lib/addresslogic/version.rb</a> | ||
</li> | ||
<li class='other'> | ||
<a href="../files/lib/addresslogic_rb.html">lib/addresslogic.rb</a> | ||
</li> | ||
<li> | ||
<a class='show' href='#' onclick='this.parentNode.parentNode.className += " expanded"; this.parentNode.removeChild(this); return false'>show all</a> | ||
</li> | ||
</ol> | ||
</div> | ||
<div id='content'> | ||
<div id='text'> | ||
<div id='description'> | ||
<h1>Address Logic</h1> | ||
<p> | ||
This is a simple module that you can include into any classm as long as it | ||
has a street1, street2, city, state, zip, and country (optional) methods. | ||
Just include it into your class like so: | ||
</p> | ||
<pre>class Address
 include AddressLogic
end</pre> | ||
<p> | ||
This adds a sigle method: address_parts. More on this method below... | ||
</p> | ||
</div> | ||
<div id='method-list'> | ||
<h2>Methods</h2> | ||
<h3>public instance</h3> | ||
<ol> | ||
<li><a href="#M000001">address_parts</a></li> | ||
</ol> | ||
</div> | ||
<div id='section'> | ||
<div id='class-list'> | ||
<h2>Classes and Modules</h2> | ||
Class <a href="Addresslogic/Version.html" class="link">Addresslogic::Version</a><br /> | ||
</div> | ||
<div id='methods'> | ||
<h2>Public instance methods</h2> | ||
<div class='public-instance method' id='method-M000001'> | ||
<a name='M000001'> </a> | ||
<div class='synopsis'> | ||
<span class='name'>address_parts</span> | ||
<span class='arguments'>(options = {})</span> | ||
</div> | ||
<div class='description'> | ||
<p> | ||
Returns the parts of an address in an array. Example: | ||
</p> | ||
<pre>["Street1", "Street2", "City, State, Zip", "Country"]</pre> | ||
<p> | ||
This makes displaying addresses on your view pretty simple: | ||
</p> | ||
<pre>address.address_parts.join("<br />")</pre> | ||
<h3>Options</h3> | ||
<ul> | ||
<li><tt>only:</tt> fields you want included in the result | ||
|
||
</li> | ||
<li><tt>except:</tt> any fields you want excluded from the result | ||
|
||
</li> | ||
</ul> | ||
</div> | ||
<div class='source'> | ||
<a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false"> | ||
[show source] | ||
</a> | ||
<pre id='M000001-source'><span class="ruby-comment cmt"># File lib/addresslogic.rb, line 24</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">address_parts</span>(<span class="ruby-identifier">options</span> = {})
 <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:only</span>] = [<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:only</span>]] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:only</span>] <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:only</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
 <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:except</span>] = [<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:except</span>]] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:except</span>] <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:except</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
 
 <span class="ruby-identifier">parts</span> = {}
 [<span class="ruby-identifier">:street1</span>, <span class="ruby-identifier">:street2</span>, <span class="ruby-identifier">:city</span>, <span class="ruby-identifier">:state</span>, <span class="ruby-identifier">:zip</span>, <span class="ruby-identifier">:country</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span>
 <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">part</span>)
 <span class="ruby-identifier">value</span> = <span class="ruby-identifier">send</span>(<span class="ruby-identifier">part</span>)
 <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:only</span>] <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:only</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">part</span>)) <span class="ruby-operator">||</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:except</span>] <span class="ruby-operator">&&</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:except</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">part</span>))
 <span class="ruby-identifier">parts</span>[<span class="ruby-identifier">part</span>] = <span class="ruby-identifier">value</span>
 <span class="ruby-keyword kw">end</span>
 
 <span class="ruby-identifier">state_parts</span> = [<span class="ruby-identifier">parts</span>[<span class="ruby-identifier">:state</span>], <span class="ruby-identifier">parts</span>[<span class="ruby-identifier">:zip</span>]].<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">" "</span>)
 <span class="ruby-identifier">state_parts</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">state_parts</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span>
 <span class="ruby-identifier">city_parts</span> = [<span class="ruby-identifier">parts</span>[<span class="ruby-identifier">:city</span>], <span class="ruby-identifier">state_parts</span>].<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">", "</span>)
 <span class="ruby-identifier">city_parts</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">city_parts</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span>
 [<span class="ruby-identifier">parts</span>[<span class="ruby-identifier">:street1</span>], <span class="ruby-identifier">parts</span>[<span class="ruby-identifier">:street2</span>], <span class="ruby-identifier">city_parts</span>, <span class="ruby-identifier">parts</span>[<span class="ruby-identifier">:country</span>]].<span class="ruby-identifier">compact</span>
 <span class="ruby-keyword kw">end</span></pre> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div id='footer-push'></div> | ||
</div> | ||
<div id='footer'> | ||
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a> | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.