Subversion Info

Rev
437
Last Checked In
2008-03-28 00:49:20 (2 weeks ago)
Checked in by
deveiant

Parent

Namespace

Class Index

Quicksearch

Arrow::DataSource

The visitor patterned criteria extension to the Arrow::DataSource class.

Constants

SVNRev
SVN Revision
SVNId
SVN Id
SVNRev
SVN Revision
SVNId
SVN Id

Attributes

source[R]
The source string which identified this DataSource.

Public Class Methods

inherited(klass) click to toggle source

Registers the class as a valid type to create objects as.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/datasource.rb, line 60
60:     def self::inherited(klass)
61:         @@source_types[klass.name.downcase] = klass
62:     end
new(string) click to toggle source

Creates a new object of the class specified by the url provided.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/datasource.rb, line 49
49:     def self::new(string)
50:         type, source = string.split('//')
51:         type.downcase!
52:         if @@source_types[type]
53:             @@source_types[type].new(source)
54:         else
55:             raise Arrow::TypeError.new("Unknown data source type '%s'" % type)
56:         end
57:     end

Public Instance Methods

==(other) click to toggle source

Test to see if two DataSource‘s can be used in place of each other.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/datasource.rb, line 72
72:     def ==(other)
73:         (self.singleton_methods.sort) == (other.singleton_methods.sort)
74:     end
criteria() click to toggle source

Return the criteria table for construction of a query.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/datasourcecriteria.rb, line 50
50:     def criteria
51:         Table.new
52:     end
criteria?() click to toggle source

Returns whether the optional criteria extensions are loaded.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/datasourcecriteria.rb, line 44
44:     def criteria?
45:         true
46:     end
make_test(name = Time.now.to_i) click to toggle source

Convert the DataSource object into a DataSource::TestData object. This will create a new TestData object each time it is called, to within a second.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/datasource.rb, line 79
79:     def make_test(name = Time.now.to_i)
80:         TestData.create(self, name)
81:     end

secsequence

--- SEC00043

seccomment

--- ""

classlist

--- |
Class <a href="DataSource/TestData.html" class="link">Arrow::DataSource::TestData</a><br />

attributes

--- 
- name: source
  rw: R
  a_desc: |+
    
    The source string which identified this <a
    href="DataSource.html">DataSource</a>.
    

method_list

--- 
- methods: 
  - visibility: public
    aref: M000375
    name: inherited
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/datasource.rb, line 60</span>\n\
      60:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">inherited</span>(<span class=\"ruby-identifier\">klass</span>)\n\
      61:         <span class=\"ruby-ivar\">@@source_types</span>[<span class=\"ruby-identifier\">klass</span>.<span class=\"ruby-identifier\">name</span>.<span class=\"ruby-identifier\">downcase</span>] = <span class=\"ruby-identifier\">klass</span>\n\
      62:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Registers the class as a valid type to create objects as.
      </p>
    params: (klass)
  - visibility: public
    aref: M000374
    name: new
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/datasource.rb, line 49</span>\n\
      49:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">new</span>(<span class=\"ruby-identifier\">string</span>)\n\
      50:         <span class=\"ruby-identifier\">type</span>, <span class=\"ruby-identifier\">source</span> = <span class=\"ruby-identifier\">string</span>.<span class=\"ruby-identifier\">split</span>(<span class=\"ruby-value str\">'//'</span>)\n\
      51:         <span class=\"ruby-identifier\">type</span>.<span class=\"ruby-identifier\">downcase!</span>\n\
      52:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-ivar\">@@source_types</span>[<span class=\"ruby-identifier\">type</span>]\n\
      53:             <span class=\"ruby-ivar\">@@source_types</span>[<span class=\"ruby-identifier\">type</span>].<span class=\"ruby-identifier\">new</span>(<span class=\"ruby-identifier\">source</span>)\n\
      54:         <span class=\"ruby-keyword kw\">else</span>\n\
      55:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">TypeError</span>.<span class=\"ruby-identifier\">new</span>(<span class=\"ruby-value str\">&quot;Unknown data source type '%s'&quot;</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-identifier\">type</span>)\n\
      56:         <span class=\"ruby-keyword kw\">end</span>\n\
      57:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Creates a <a href="DataSource.html#M000374">new</a> object of the class
      specified by the url provided.
      </p>
    params: (string)
  category: Class
  type: Public
- methods: 
  - visibility: public
    aref: M000376
    name: ==
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/datasource.rb, line 72</span>\n\
      72:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-operator\">==</span>(<span class=\"ruby-identifier\">other</span>)\n\
      73:         (<span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">singleton_methods</span>.<span class=\"ruby-identifier\">sort</span>) <span class=\"ruby-operator\">==</span> (<span class=\"ruby-identifier\">other</span>.<span class=\"ruby-identifier\">singleton_methods</span>.<span class=\"ruby-identifier\">sort</span>)\n\
      74:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Test to see if two <a href="DataSource.html">DataSource</a>&#8216;s can be
      used in place of each other.
      </p>
    params: (other)
  - visibility: public
    aref: M000379
    name: criteria
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/datasourcecriteria.rb, line 50</span>\n\
      50:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">criteria</span>\n\
      51:         <span class=\"ruby-constant\">Table</span>.<span class=\"ruby-identifier\">new</span>\n\
      52:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return the <a href="DataSource.html#M000379">criteria</a> table for
      construction of a query.
      </p>
    params: ()
  - visibility: public
    aref: M000378
    name: criteria?
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/datasourcecriteria.rb, line 44</span>\n\
      44:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">criteria?</span>\n\
      45:         <span class=\"ruby-keyword kw\">true</span>\n\
      46:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns whether the optional <a href="DataSource.html#M000379">criteria</a>
      extensions are loaded.
      </p>
    params: ()
  - visibility: public
    aref: M000377
    name: make_test
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/datasource.rb, line 79</span>\n\
      79:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">make_test</span>(<span class=\"ruby-identifier\">name</span> = <span class=\"ruby-constant\">Time</span>.<span class=\"ruby-identifier\">now</span>.<span class=\"ruby-identifier\">to_i</span>)\n\
      80:         <span class=\"ruby-constant\">TestData</span>.<span class=\"ruby-identifier\">create</span>(<span class=\"ruby-keyword kw\">self</span>, <span class=\"ruby-identifier\">name</span>)\n\
      81:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Convert the <a href="DataSource.html">DataSource</a> object into a <a
      href="DataSource/TestData.html">DataSource::TestData</a> object. This will
      create a <a href="DataSource.html#M000374">new</a> <a
      href="DataSource/TestData.html">TestData</a> object each time it is called,
      to within a second.
      </p>
    params: (name = Time.now.to_i)
  category: Instance
  type: Public

sectitle

--- 

constants

--- 
- name: SVNRev
  desc: |+
    
    SVN Revision
    
  value: "%q$Rev: 437 $"
- name: SVNId
  desc: |+
    
    SVN Id
    
  value: "%q$Id: datasource.rb 437 2008-03-28 00:49:20Z deveiant $"
- name: SVNRev
  desc: |+
    
    SVN Revision
    
  value: "%q$Rev: 437 $"
- name: SVNId
  desc: |+
    
    SVN Id
    
  value: "%q$Id: datasourcecriteria.rb 437 2008-03-28 00:49:20Z deveiant $"

[Validate]

Generated with the Darkfish Rdoc Generator.