Class: Pineapples::Actions::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/pineapples/actions/base/target.rb

Constant Summary collapse

PASS_REGEX =
/!=(.*?)!/
GUARD_REGEX =
/!(.*?)!/
FILENAME_REGEX =
/%(.*?)%/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, generator) ⇒ Target

Returns a new instance of Target.

Raises:



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pineapples/actions/base/target.rb', line 13

def initialize(target, generator)
  raise Error, 'Target should not be falsy' if !target

  @generator = generator
  @given = target.to_s

  match!

  @fullpath = File.expand_path(@given, generator.current_app_dir)
  @relative = generator.relative_to_current_app_dir(@fullpath)
end

Instance Attribute Details

#fullpathObject (readonly)

Returns the value of attribute fullpath.



8
9
10
# File 'lib/pineapples/actions/base/target.rb', line 8

def fullpath
  @fullpath
end

#generatorObject (readonly)

Returns the value of attribute generator.



8
9
10
# File 'lib/pineapples/actions/base/target.rb', line 8

def generator
  @generator
end

#givenObject (readonly)

Returns the value of attribute given.



8
9
10
# File 'lib/pineapples/actions/base/target.rb', line 8

def given
  @given
end

#relativeObject (readonly)

Returns the value of attribute relative.



8
9
10
# File 'lib/pineapples/actions/base/target.rb', line 8

def relative
  @relative
end

Instance Method Details

#skip?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/pineapples/actions/base/target.rb', line 25

def skip?
  @skip
end