Class: Bootinq::Component
- Inherits:
- 
      Object
      
        - Object
- Bootinq::Component
 
- Defined in:
- lib/bootinq/component.rb
Direct Known Subclasses
Instance Attribute Summary collapse
- 
  
    
      #group  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute group. 
- 
  
    
      #id2name  ⇒ Object 
    
    
      (also: #to_s, #gem_name, #name)
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute id2name. 
- 
  
    
      #intern  ⇒ Object 
    
    
      (also: #to_sym)
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute intern. 
Coercing methods collapse
- 
  
    
      #coerce(other)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Coerces other value. 
- 
  
    
      #coerce_to(other)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Coerces self to other value klass. 
Comparation methods collapse
Symbol-delegated methods collapse
- 
  
    
      #__id__  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    Identifier for #intern. 
- 
  
    
      #hash  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    #intern's hash. 
- 
  
    
      #inspect  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Representation of #intern as a symbol literal. 
- 
  
    
      #to_proc  ⇒ Proc 
    
    
  
  
  
  
  
  
  
  
  
    Responded to the given method by #intern. 
String-delegated methods collapse
- #=~(arg) ⇒ Object
- #empty? ⇒ Boolean
- 
  
    
      #encoding  ⇒ Encoding 
    
    
  
  
  
  
  
  
  
  
  
    Of #id2name. 
- 
  
    
      #length  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    Length of #id2name. 
- #match(*args) {|MatchData| ... } ⇒ MatchData, Any
- 
  
    
      #match?(*args)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Indicates whether the regexp is matched or not. 
- 
  
    
      #slice(*args)  ⇒ Object 
    
    
      (also: #[])
    
  
  
  
  
  
  
  
  
  
    Element reference. 
Symbol-delegated mutation methods collapse
- 
  
    
      #capitalize  ⇒ Bootinq::Component 
    
    
  
  
  
  
  
  
  
  
  
    New instance with capitalized #intern. 
- 
  
    
      #downcase  ⇒ Bootinq::Component 
    
    
  
  
  
  
  
  
  
  
  
    New instance with downcased #intern. 
- 
  
    
      #next  ⇒ Bootinq::Component 
    
    
  
  
  
  
  
  
  
  
  
    New instance with the next #intern. 
- 
  
    
      #succ  ⇒ Bootinq::Component 
    
    
  
  
  
  
  
  
  
  
  
    New instance with the successor #intern. 
- 
  
    
      #swapcase  ⇒ Bootinq::Component 
    
    
  
  
  
  
  
  
  
  
  
    New instance with swapcased #intern. 
- 
  
    
      #upcase  ⇒ Bootinq::Component 
    
    
  
  
  
  
  
  
  
  
  
    New instance with upcased #intern. 
Class Method Summary collapse
Instance Method Summary collapse
- #engine
- #initialize(intern) ⇒ self constructor
- #kind_of?(klass) ⇒ Boolean
- #module_name ⇒ Symbol
- #mountable? ⇒ Boolean
- #namespace ⇒ Module
Constructor Details
#initialize(intern) ⇒ self
| 34 35 36 37 38 | # File 'lib/bootinq/component.rb', line 34 def initialize(intern) @intern = intern.to_sym @id2name = intern.to_s.freeze @group = :"#{@id2name}_boot" end | 
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
| 18 19 20 | # File 'lib/bootinq/component.rb', line 18 def group @group end | 
#id2name ⇒ Object (readonly) Also known as: to_s, gem_name, name
Returns the value of attribute id2name.
| 13 14 15 | # File 'lib/bootinq/component.rb', line 13 def id2name @id2name end | 
#intern ⇒ Object (readonly) Also known as: to_sym
Returns the value of attribute intern.
| 8 9 10 | # File 'lib/bootinq/component.rb', line 8 def intern @intern end | 
Class Method Details
.new(intern) ⇒ Bootinq::Component
Returns frozen.
| 28 29 30 | # File 'lib/bootinq/component.rb', line 28 def self.new(intern) super.freeze end | 
Instance Method Details
#==(other) ⇒ Boolean
| 108 109 110 111 | # File 'lib/bootinq/component.rb', line 108 def ==(other) other = coerce(other) other == coerce_to(other) end | 
#===(other) ⇒ Boolean
| 115 116 117 118 | # File 'lib/bootinq/component.rb', line 115 def ===(other) other = coerce(other) other === coerce_to(other) end | 
#=~(pattern) ⇒ Integer? #=~(arg) ⇒ Object
| 205 206 207 | # File 'lib/bootinq/component.rb', line 205 def =~(arg) @id2name =~ arg end | 
#__id__ ⇒ Integer
Returns identifier for #intern.
| 151 152 153 | # File 'lib/bootinq/component.rb', line 151 def __id__ @intern.__id__ end | 
#capitalize ⇒ Bootinq::Component
Returns new instance with capitalized #intern.
| 237 238 239 | # File 'lib/bootinq/component.rb', line 237 def capitalize self.class.new(@intern.capitalize) end | 
#casecmp(other) ⇒ Boolean
| 122 123 124 125 | # File 'lib/bootinq/component.rb', line 122 def casecmp(other) other = coerce(other) coerce_to(other).casecmp(other) end | 
#casecmp?(other) ⇒ Boolean
| 129 130 131 132 | # File 'lib/bootinq/component.rb', line 129 def casecmp?(other) other = coerce(other) coerce_to(other).casecmp?(other) end | 
#coerce(symbol) ⇒ Symbol #coerce(other) ⇒ String
Coerces other value
| 93 94 95 96 97 98 | # File 'lib/bootinq/component.rb', line 93 def coerce(other) case other when String, Symbol; other else other.to_s end end | 
#coerce_to(string) ⇒ String #coerce_to(symbol) ⇒ Symbol #coerce_to(other) ⇒ self
Coerces self to other value klass.
| 78 79 80 81 82 83 84 | # File 'lib/bootinq/component.rb', line 78 def coerce_to(other) case other when String; @id2name when Symbol; @intern else self end end | 
#downcase ⇒ Bootinq::Component
Returns new instance with downcased #intern.
| 231 232 233 | # File 'lib/bootinq/component.rb', line 231 def downcase self.class.new(@intern.downcase) end | 
#empty? ⇒ Boolean
| 172 173 174 | # File 'lib/bootinq/component.rb', line 172 def empty? @id2name.empty? end | 
#encoding ⇒ Encoding
Returns of #id2name.
| 167 168 169 | # File 'lib/bootinq/component.rb', line 167 def encoding @id2name.encoding end | 
#engine
This method returns an undefined value.
| 56 57 | # File 'lib/bootinq/component.rb', line 56 def engine end | 
#hash ⇒ Integer
Returns #intern's hash.
| 156 157 158 | # File 'lib/bootinq/component.rb', line 156 def hash @intern.hash end | 
#inspect ⇒ String
Returns representation of #intern as a symbol literal.
| 141 142 143 | # File 'lib/bootinq/component.rb', line 141 def inspect @intern.inspect end | 
#kind_of?(klass) ⇒ Boolean
| 61 62 63 | # File 'lib/bootinq/component.rb', line 61 def kind_of?(klass) super || @intern.kind_of?(klass) end | 
#length ⇒ Integer
Returns length of #id2name.
| 177 178 179 | # File 'lib/bootinq/component.rb', line 177 def length @id2name.length end | 
#match(*args) {|MatchData| ... } ⇒ MatchData, Any
| 187 188 189 | # File 'lib/bootinq/component.rb', line 187 def match(*args, &block) @id2name.match(*args, &block) end | 
#match?(*args) ⇒ Boolean
Returns indicates whether the regexp is matched or not.
| 194 195 196 | # File 'lib/bootinq/component.rb', line 194 def match?(*args) @id2name.match?(*args) end | 
#module_name ⇒ Symbol
| 46 47 48 | # File 'lib/bootinq/component.rb', line 46 def module_name @id2name.camelcase.to_sym end | 
#mountable? ⇒ Boolean
| 41 42 43 | # File 'lib/bootinq/component.rb', line 41 def mountable? false end | 
#namespace ⇒ Module
| 51 52 53 | # File 'lib/bootinq/component.rb', line 51 def namespace Object.const_get(module_name) end | 
#next ⇒ Bootinq::Component
Returns new instance with the next #intern.
| 255 256 257 | # File 'lib/bootinq/component.rb', line 255 def next self.class.new(@intern.next) end | 
#slice(*args) ⇒ Object Also known as: []
Element reference
| 211 212 213 | # File 'lib/bootinq/component.rb', line 211 def slice(*args) @id2name[*args] end | 
#succ ⇒ Bootinq::Component
Returns new instance with the successor #intern.
| 249 250 251 | # File 'lib/bootinq/component.rb', line 249 def succ self.class.new(@intern.succ) end | 
#swapcase ⇒ Bootinq::Component
Returns new instance with swapcased #intern.
| 243 244 245 | # File 'lib/bootinq/component.rb', line 243 def swapcase self.class.new(@intern.swapcase) end | 
#to_proc ⇒ Proc
Returns responded to the given method by #intern.
| 146 147 148 | # File 'lib/bootinq/component.rb', line 146 def to_proc @intern.to_proc end | 
#upcase ⇒ Bootinq::Component
Returns new instance with upcased #intern.
| 225 226 227 | # File 'lib/bootinq/component.rb', line 225 def upcase self.class.new(@intern.upcase) end |