Sha256: bce8dd8d8c74e346075ab39edc030c72a9032e65a47c46e9f9236ac150c3a600
Contents?: true
Size: 759 Bytes
Versions: 1
Compression:
Stored size: 759 Bytes
Contents
require 'inflecto' module Rodakase def self.Component(input) Component.new(Component.identifier(input), Component.path(input)) end class Component IDENTIFIER_SEPARATOR = '.'.freeze PATH_SEPARATOR = '/'.freeze attr_reader :identifier, :path, :file def self.identifier(input) input.gsub(PATH_SEPARATOR, IDENTIFIER_SEPARATOR) end def self.path(input) input.gsub(IDENTIFIER_SEPARATOR, PATH_SEPARATOR) end def initialize(identifier, path) @identifier = identifier @path = path @file = "#{path}.rb" end def name Inflecto.camelize(path) end def constant Inflecto.constantize(name) end def instance(*args) constant.new(*args) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rodakase-0.0.1 | lib/rodakase/component.rb |