Sha256: 91afdcededfa73bf33f4a30592b157e04874c8dd7ad7baeccb7022848627e260

Contents?: true

Size: 535 Bytes

Versions: 13

Compression:

Stored size: 535 Bytes

Contents

# The permissions granted to the API user.
class Rosemary::Permissions
  include Enumerable

  attr_reader :raw

  def initialize
    @raw = []
  end

  # make sure we can add permissions and are "Enumerable" via delegation to the permissions array
  delegate :<<, :each, :to => :raw

  # some convenience helpers for permissions we already know:
  %w(allow_read_prefs allow_write_prefs allow_write_diary
     allow_write_api allow_read_gpx allow_write_gpx).each do |name|
    define_method("#{name}?") { raw.include?(name) }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rosemary-0.4.4 lib/rosemary/permissions.rb
rosemary-0.4.3 lib/rosemary/permissions.rb
rosemary-0.4.2 lib/rosemary/permissions.rb
rosemary-0.4.1 lib/rosemary/permissions.rb
rosemary-0.4.0 lib/rosemary/permissions.rb
rosemary-0.3.12 lib/rosemary/permissions.rb
rosemary-0.3.11 lib/rosemary/permissions.rb
rosemary-0.3.10 lib/rosemary/permissions.rb
rosemary-0.3.9 lib/rosemary/permissions.rb
rosemary-0.3.8 lib/rosemary/permissions.rb
rosemary-0.3.7 lib/rosemary/permissions.rb
rosemary-0.3.6 lib/rosemary/permissions.rb
rosemary-0.3.5 lib/rosemary/permissions.rb