Class: Localite::Scopes
- Inherits:
-
Array
- Object
- Array
- Localite::Scopes
- Defined in:
- lib/localite/scopes.rb
Defined Under Namespace
Modules: Etest
Instance Method Summary collapse
- #each(s) {|s.to_s| ... } ⇒ Object
- #first(s) ⇒ Object
-
#initialize ⇒ Scopes
constructor
A new instance of Scopes.
- #inspect ⇒ Object
- #pop(*array) ⇒ Object
- #push(*array) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Scopes
Returns a new instance of Scopes.
2 3 4 |
# File 'lib/localite/scopes.rb', line 2 def initialize @prebuilt = [] end |
Instance Method Details
#each(s) {|s.to_s| ... } ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/localite/scopes.rb', line 25 def each(s) @prebuilt.reverse_each do |entry| yield "#{entry}.#{s}" end yield s.to_s end |
#first(s) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/localite/scopes.rb', line 33 def first(s) if @prebuilt.last "#{@prebuilt.last}.#{s}" else s end end |
#inspect ⇒ Object
45 46 47 |
# File 'lib/localite/scopes.rb', line 45 def inspect to_s.inspect end |
#pop(*array) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/localite/scopes.rb', line 18 def pop(*array) array.each do @prebuilt.pop super() end end |
#push(*array) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/localite/scopes.rb', line 6 def push(*array) array.each do |s| if @prebuilt.last @prebuilt.push("#{@prebuilt.last}.#{s}") else @prebuilt.push(s.to_s) end super(s) end end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/localite/scopes.rb', line 41 def to_s join(":") end |