Class: JGrouper::Field
- Inherits:
-
Object
- Object
- JGrouper::Field
- Defined in:
- lib/jgrouper/field.rb
Overview
JGrouper::Field - Grouper Group Field
Usage
require 'jgrouper'
TODO
Instance Method Summary collapse
-
#initialize(obj = nil) {|_self| ... } ⇒ Field
constructor
A new instance of Field.
-
#method_missing(meth, *args, &block) ⇒ Object
For passing methods on to Grouper Field object.
- #to_hash ⇒ Object
- #to_yaml ⇒ Object
Constructor Details
#initialize(obj = nil) {|_self| ... } ⇒ Field
Returns a new instance of Field.
15 16 17 18 19 |
# File 'lib/jgrouper/field.rb', line 15 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 Field object.
24 25 26 27 28 29 30 31 32 |
# File 'lib/jgrouper/field.rb', line 24 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_hash ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/jgrouper/field.rb', line 34 def to_hash { 'kind' => 'field', 'name' => @obj.get_name, 'uuid' => @obj.get_uuid, 'nullable' => @obj.get_is_nullable, 'required' => @obj.get_required, 'privilege' => { 'read' => @obj.get_read_privilege, 'write' => @obj.get_write_privilege } } end |
#to_yaml ⇒ Object
48 49 50 |
# File 'lib/jgrouper/field.rb', line 48 def to_yaml to_hash.to_yaml end |