module ROM::LDAP::Relation::Exporting

LDIF, JSON, YAML and if loading extensions MsgPack and DSML.

Public Instance Methods

to_json(_opts = nil) click to toggle source

Export the relation as JSON

@param _opts [Mixed] compatibility with JSON.generate

@return [String]

@example

relation.to_json
JSON.generate(relation)

@api public

# File lib/rom/ldap/relation/exporting.rb, line 39
def to_json(_opts = nil)
  export.to_json
end
to_ldif() click to toggle source

Export the relation as LDIF

@return [String]

@example

relation.to_ldif

@api public

# File lib/rom/ldap/relation/exporting.rb, line 24
def to_ldif
  export.to_ldif
end
to_yaml() click to toggle source

Export the relation as YAML

@return [String]

@example

relation.to_yaml

@api public

# File lib/rom/ldap/relation/exporting.rb, line 51
def to_yaml
  export.to_yaml
end

Private Instance Methods

export() click to toggle source

Serialize the selected dataset attributes in a formatted string.

@example i.e. YAML, JSON, LDIF, BINARY

#=> relation.export.to_format

@return [Hash, Array<Hash>]

@api public

# File lib/rom/ldap/relation/exporting.rb, line 65
def export
  dataset.respond_to?(:export) ? dataset.export : dataset
end