Module: InJson

Defined in:
lib/in_json.rb,
lib/in_json/ext/hash.rb,
lib/in_json/ext/array.rb

Defined Under Namespace

Modules: ArrayExt, ClassMethods, HashExt, InstanceMethods Classes: Definition

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
# File 'lib/in_json.rb', line 5

def self.included(base)
  base.extend ClassMethods
  base.send :include, InstanceMethods
end

.with(name = :default, &block) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/in_json.rb', line 10

def self.with(name = :default, &block)
  begin
    Thread.current[:in_json_definition] = name
    yield
  ensure
    Thread.current[:in_json_definition] = nil
  end
end