Sha256: 200e8a1044f33378a8e216cf60563a9861c6c2077bb0ece966878fc0769df8b3

Contents?: true

Size: 680 Bytes

Versions: 20

Compression:

Stored size: 680 Bytes

Contents

module NicoQuery
  module ObjectMapper
    class Description
      attr_reader :raw_text, :movie_references, :movie_references,
                  :community_references, :seiga_references

      def initialize(raw_text)
        @raw_text = raw_text.to_s
      end

      def text
        @raw_text
      end

      def movie_references
        # is this the high road?
        text.scan(/((sm|nm)\d{1,})/).map {|e| e[0]}
      end

      def mylist_references
        text.scan(/(?<=mylist\/)\d{1,}/).map(&:to_i)
      end

      def community_references
        text.scan(/co\d{1,}/)
      end

      def seiga_references
        text.scan(/im\d{1,}/)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
nicoquery-0.1.8.11 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8.10 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8.9 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8.8 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8.7 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8.6 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8.5 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8.4 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8.3 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8.2 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.8 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.7 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.6.1 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.6 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.5 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.4 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.3 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.2 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.1 lib/nicoquery/object_mapper/description.rb
nicoquery-0.1.0 lib/nicoquery/object_mapper/description.rb