Class: Localite::Scope::Scopes

Inherits:
Array
  • Object
show all
Defined in:
lib/localite/scope.rb

Instance Method Summary collapse

Instance Method Details

#each(s) {|s| ... } ⇒ Object

Yields:

  • (s)


71
72
73
74
75
76
77
# File 'lib/localite/scope.rb', line 71

def each(s)
  reverse_each do |entry| 
    yield "#{entry}.#{s}"
  end

  yield s
end

#exec(s, &block) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/localite/scope.rb', line 62

def exec(s, &block)
  s = "#{last}.#{s}" if last
  push s
  
  yield
ensure
  pop
end

#first(s) ⇒ Object



79
80
81
82
83
# File 'lib/localite/scope.rb', line 79

def first(s)
  each(s) do |entry|
    return entry
  end
end