Class: Social::Env

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/social/env.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEnv

Returns a new instance of Env.



30
31
32
# File 'lib/social/env.rb', line 30

def initialize
  @inited = false
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/social/env.rb', line 5

def id
  @id
end

#prefixObject

Returns the value of attribute prefix.



5
6
7
# File 'lib/social/env.rb', line 5

def prefix
  @prefix
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/social/env.rb', line 5

def type
  @type
end

Class Method Details

.init(social_type) ⇒ Object



11
12
13
14
15
16
# File 'lib/social/env.rb', line 11

def init(social_type)
  instance.type   = social_type
  instance.id     = Social.id_by_type(social_type)
  instance.prefix = Social.prefix_by_type(social_type)
  instance.instance_variable_set(:"@inited", true)
end

.init_by_params(params) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/social/env.rb', line 18

def init_by_params(params)
  unless social_type = Social.request_social_type(params)
    raise "Can't find social type into SocialEnv or SocialParams with params: #{params.inspect}"
  else
    init(social_type)
  end
end

Instance Method Details

#inited?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/social/env.rb', line 34

def inited?
  @inited
end