Class: JGrouper::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/jgrouper/group.rb

Overview

JGrouper::Group - Grouper Group

Usage

require 'jgrouper'

TODO

Instance Method Summary collapse

Constructor Details

#initialize(obj = nil) {|_self| ... } ⇒ Group

Returns a new instance of Group.

Yields:

  • (_self)

Yield Parameters:



16
17
18
19
20
# File 'lib/jgrouper/group.rb', line 16

def initialize( obj = nil )
  @obj = obj
  yield self if block_given?
  self
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object

For passing methods on to Grouper Group object.



25
26
27
28
29
30
31
32
33
# File 'lib/jgrouper/group.rb', line 25

def method_missing(meth, *args, &block)
  super if @obj.nil?
  begin
    block.call @obj.send(meth, *args) if block
    @obj.send(meth, *args)
  rescue NoMethodError
    super
  end
end

Instance Method Details

#to_sObject



35
36
37
38
# File 'lib/jgrouper/group.rb', line 35

def to_s
  return nil if @obj.nil?
  CSV.generate_line %w( name display_name uuid ).collect { |k| "#{k}=#{ self.send(k) }" }
end