Class: Bootinq::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/bootinq/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(intern) ⇒ Component

Returns a new instance of Component.



12
13
14
15
16
17
# File 'lib/bootinq/component.rb', line 12

def initialize(intern)
  @intern  = intern.to_sym
  @id2name = intern.to_s.freeze
  @group   = :"#@id2name\_boot"
  freeze
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



5
6
7
# File 'lib/bootinq/component.rb', line 5

def group
  @group
end

#id2nameObject (readonly) Also known as: to_s, gem_name, name

Returns the value of attribute id2name.



5
6
7
# File 'lib/bootinq/component.rb', line 5

def id2name
  @id2name
end

#internObject (readonly) Also known as: to_sym

Returns the value of attribute intern.



5
6
7
# File 'lib/bootinq/component.rb', line 5

def intern
  @intern
end

Instance Method Details

#==(other) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/bootinq/component.rb', line 34

def == other
  case other
  when String then other == @id2name
  when Symbol then other == @intern
              else super
  end
end

#===(other) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/bootinq/component.rb', line 42

def ===(other)
  case other
  when String then other === @id2name
  when Symbol then other === @intern
              else super
  end
end

#casecmp(other) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/bootinq/component.rb', line 50

def casecmp(other)
  case other
  when String then @id2name.casecmp(other)
  when Symbol then @intern.casecmp(other)
  when self.class then casecmp(other.to_s)
  end
end

#casecmp?(other) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
61
62
63
64
# File 'lib/bootinq/component.rb', line 58

def casecmp?(other)
  case other
  when String then @id2name.casecmp?(other)
  when Symbol then @intern.casecmp?(other)
  when self.class then casecmp?(other.to_s)
  end
end

#engineObject



27
28
# File 'lib/bootinq/component.rb', line 27

def engine
end

#kind_of?(klass) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/bootinq/component.rb', line 30

def kind_of?(klass)
  super || @intern.kind_of?(klass)
end

#module_nameObject



23
24
25
# File 'lib/bootinq/component.rb', line 23

def module_name
  @id2name.camelcase.to_sym
end

#mountable?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/bootinq/component.rb', line 19

def mountable?
  false
end