Class: AMEE::Limiter
- Inherits:
-
Object
- Object
- AMEE::Limiter
- Extended by:
- ParseHelper
- Defined in:
- lib/amee/pager.rb
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#truncated ⇒ Object
readonly
Returns the value of attribute truncated.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Limiter
constructor
A new instance of Limiter.
- #more? ⇒ Boolean
- #next! ⇒ Object
- #options ⇒ Object
- #page_fragment ⇒ Object
Methods included from ParseHelper
load_xml_doc, node_value, xmlpathpreamble
Constructor Details
#initialize(data) ⇒ Limiter
Returns a new instance of Limiter.
80 81 82 83 84 |
# File 'lib/amee/pager.rb', line 80 def initialize(data) @offset=data[:resultStart] || 0 @limit=data[:resultLimit] || 10 @truncated=data[:truncated] || false end |
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
85 86 87 |
# File 'lib/amee/pager.rb', line 85 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
85 86 87 |
# File 'lib/amee/pager.rb', line 85 def offset @offset end |
#truncated ⇒ Object (readonly)
Returns the value of attribute truncated.
85 86 87 |
# File 'lib/amee/pager.rb', line 85 def truncated @truncated end |
Class Method Details
.from_json(doc, options = {}) ⇒ Object
99 100 101 |
# File 'lib/amee/pager.rb', line 99 def self.from_json(doc,={}) raise AMEE::NotSupported end |
Instance Method Details
#more? ⇒ Boolean
86 87 88 |
# File 'lib/amee/pager.rb', line 86 def more? truncated end |
#next! ⇒ Object
89 90 91 92 |
# File 'lib/amee/pager.rb', line 89 def next! @offset+=limit more? end |
#options ⇒ Object
96 97 98 |
# File 'lib/amee/pager.rb', line 96 def {:resultStart=>offset,:resultLimit=>limit} end |
#page_fragment ⇒ Object
93 94 95 |
# File 'lib/amee/pager.rb', line 93 def page_fragment "?resultStart=#{offset}&resultLimit=#{limit}" end |