Module: EDN::Metadata

Defined in:
lib/edn/metadata.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#metadataObject

Returns the value of attribute metadata.



10
11
12
# File 'lib/edn/metadata.rb', line 10

def 
  @metadata
end

Class Method Details

.extended(base) ⇒ Object



3
4
5
6
7
8
# File 'lib/edn/metadata.rb', line 3

def self.extended(base)
  base.instance_eval do
    alias :to_edn_without_metadata :to_edn
    alias :to_edn :to_edn_with_metadata
  end
end

Instance Method Details

#has_metadata?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
# File 'lib/edn/metadata.rb', line 12

def has_metadata?
  respond_to?(:allows_metadata?) and
    allows_metadata? and
    !.nil? and
    !.empty?
end

#to_edn_with_metadataObject



19
20
21
22
23
24
25
# File 'lib/edn/metadata.rb', line 19

def 
  if has_metadata?
    '^' + .to_edn + ' ' + 
  else
    
  end
end