Module: EPUB::Inspector

Included in:
Publication::Package, Publication::Package::Manifest::Item
Defined in:
lib/epub/inspector.rb

Defined Under Namespace

Modules: PublicationModel

Constant Summary collapse

INSTANCE_VARIABLES_OPTION =
{:exclude => []}
SIMPLE_TEMPLATE =
"#<%{class}:%{object_id}>"

Instance Method Summary collapse

Instance Method Details

#inspect_instance_variables(options = {}) ⇒ Object

[View source]

17
18
19
20
21
22
23
24
25
# File 'lib/epub/inspector.rb', line 17

def inspect_instance_variables(options={})
  options = INSTANCE_VARIABLES_OPTION.merge(options)
  exclude = options[:exclude]

  (instance_variables - exclude).map {|name|
    value = instance_variable_get(name)
    "#{name}=#{value.inspect}"
  }.join(' ')
end

#inspect_object_idObject

[View source]

13
14
15
# File 'lib/epub/inspector.rb', line 13

def inspect_object_id
  (__id__ << 1).to_s(16)
end

#inspect_simplyObject

[View source]

6
7
8
9
10
11
# File 'lib/epub/inspector.rb', line 6

def inspect_simply
  SIMPLE_TEMPLATE % {
    :class => self.class,
    :object_id => inspect_object_id
  }
end