Sha256: 3970d7456cc3019f87403b8d1aa31aa2fb1dab7410ac66222fda32ec3c991b03

Contents?: true

Size: 277 Bytes

Versions: 5

Compression:

Stored size: 277 Bytes

Contents

module AttributeJsonizer
  require 'yajl'

  def to_json
    json_hash = {}
    self.instance_variables.each do |iv|
      key = iv
      value = self.instance_variable_get(iv)
      json_hash[key.to_s.gsub("@","")] = value
    end
    Yajl::Encoder.encode(json_hash)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blitline-1.2.0 lib/blitline/attribute_jsonizer.rb
blitline-1.1.0 lib/blitline/attribute_jsonizer.rb
blitline-1.0.3 lib/blitline/attribute_jsonizer.rb
blitline-1.0.2 lib/blitline/attribute_jsonizer.rb
blitline-1.0.1 lib/blitline/attribute_jsonizer.rb